Math.pow
returns different results between Int
and Float
exponents
#14307
Labels
kind:bug
A bug in the code. Does not apply to documentation, specs, etc.
platform:unix
topic:stdlib:numeric
On non-Windows platforms,
Float64#**(Int32)
andFloat64#**(Float64)
are backed byllvm.powi
andllvm.pow
respectively. The two can sometimes return different results, in particular when dealing with certain subnormal results:Reduced: (it doesn't matter whether the base value is a constant or the variable
x
)Although there are no guarantees about either form's precision, this could still be a problem since only Windows delegates
#**(Int32)
to#**(Float64)
, thus the same code will not print zero when compiled using MSVC. Maybe we should simply droppowi
on the other platforms as well?See also: llvm/llvm-project#65088
The text was updated successfully, but these errors were encountered: