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
{{ message }}
Repository navigation
Real.fromString on negative inf/infinity returns positive infinity #362
Real.fromString "-inf" returns SOME inf, i.e., positive infinity. It appears to only be a problem with inf/infinity parsing (e.g., in the the -nan case we get a negative sign bit).
Transcript
Testing a few combinations of [~-](inf|infinity); all of these return positive inf.
Standard ML of New Jersey [Version 110.99.8; 64-bit; April 25, 2025]
-
- fun test x = Real.== (Real.posInf, valOf (Real.fromString x));
val test = fn : string -> bool
-
- test "-inf"; test "~inf"; test "-infinity"; test "~infinity";
val it = true : bool
val it = true : bool
val it = true : bool
val it = true : bool
Confirming that negative nan is parsing correctly:
- Real.fromString "-nan"; Real.signBit (valOf it);
val it = SOME nan : real option
val it = true : bool
-
- Real.fromString "nan"; Real.signBit (valOf it);
val it = SOME nan : real option
val it = false : bool
Expected Behavior
Real.fromString on "-inf" and similar inputs should return SOME (~inf).
Activity
Fix for Issue #362 (`Real.fromString` on negative inf/infinity return…
JohnReppy commentedon Jun 12, 2025
This issue was caused by a copy-paste error for the bit-representation of negative infinity. It has been fixed for 110.99.9.