Fable
Fable copied to clipboard
float32 arithmetics
Description
Arithmetic operations on a float32 may produce numbers that are only representable as float64.
Repro code
This prints
2.7
2.7
but 2.7 is not a number that is representable as float32. On .NET, the same code prints
2.7
2.700000048f
Doing Math.fround(2.7) in the console returns 2.700000047683716, which corresponds to the .NET float32. Shouldn't all float32 operations, not just literals, be wrapped in an fround?
Related information
- Fable version: 3.4.10 in the REPL
Probably... tbh I haven't paid a lot of attention to having proper arithmetic with .net numeric types 😅 Most of the work on this regard has been done by @ncave