You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is my understanding that subnormal floats sacrifice precision in order to allow representations that are "close" to zero. However, because 9.3494547075363499E-311 is larger than the smallest subnormal float, the behavior of Base.parse is what I would expect. I would only expect a parser to return 0.0 if the number being parsed is smaller than the smallest subnormal float.
By the way, Python's built-in parser behaves like Base.parse and not Parsers.parse. Using Python 3.9.6:
Fixes#83. Previously, we eagerly bailed for small enough exponents when
parsing. Instead, we can take a slightly slower path by falling back on
BigInt/BigFloat for however small the exponent is to do the correct
scaling.
Fixes#83. Previously, we eagerly bailed for small enough exponents when
parsing. Instead, we can take a slightly slower path by falling back on
BigInt/BigFloat for however small the exponent is to do the correct
scaling.
I use
Base.parse
, I get different results than if I useParsers.parse
:I believe what is happening is that:
It is my understanding that subnormal floats sacrifice precision in order to allow representations that are "close" to zero. However, because
9.3494547075363499E-311
is larger than the smallest subnormal float, the behavior ofBase.parse
is what I would expect. I would only expect a parser to return0.0
if the number being parsed is smaller than the smallest subnormal float.By the way, Python's built-in parser behaves like
Base.parse
and notParsers.parse
. Using Python 3.9.6:Similarly, C's
atof
behaves likeBase.parse
and notParsers.parse
:The above C source produces the output:
Is there a good reason why
Parsers.parse
behaves differently fromBase.parse
in this case?The text was updated successfully, but these errors were encountered: