Floating Point - yuki-kimoto/SPVM GitHub Wiki
Why SPVM floating point literal is differenct from C floatin point literal in 32bit CPU
SPVM uses C functions strtof
and strtod
to produce a floating point from SPVM floating point literal.
But the functions to produce a floating point can be different in strtof
(or strtod
) and C floating point literal.
See the following article about the reason. This is Windows document, but the reason is the same as on Linux.
https://learn.microsoft.com/en-us/cpp/c-runtime-library/floating-point-support?view=msvc-170
Why is the strinfication of infinity and NaN different on Windows and Linux?
# inf, 1.#INF, etc
my $inf = 1.0 / 0.0;
warn $inf;
# nan, -nan, 1.#IND, etc
my $nan = 0.0 / 0.0;
warn $nan;
See the following topic for the reason.
Because the floating-point output problem is complex, SPVM chose not to solve it.