Hacker News new | ask | show | jobs
by StefanKarpinski 2764 days ago
Very cool tool! A couple of comments/suggestions:

It doesn't handle very large or small floating-point numbers. I'm not sure where the cutoff is, but it's around 1e40 and 1e-46. It would be cool to be able to explore the whole range of 64-bit floats, including subnormals like 5.0e-324.

It would be interesting to leave the input as-is and show two related decimal representations:

1. The precise decimal representation (what is printed now). 2. The shortest decimal representation as determined by algorithms like Grisu [1] and Ryu [2].

It would also be cool to allow jumping to the next/previous representable floating-point number. Showing eps(x) would also be handy—i.e. the difference between the current value and the next closest representable floating-point value.

[1] https://www.cs.tufts.edu/~nr/cs257/archive/florian-loitsch/p...

[2] https://dl.acm.org/citation.cfm?id=3192369

1 comments

They're 32-bit IEEE floats (i.e. a typical "C float"), so the subnormal range is below 2e-38. Also, it isn't printing exact values, since for any non-integer value, the last digit should always be 5, though I agree it would be nice to have.
Hah, I should have realized that there weren't enough bits for Float64. I also realized that the little `+` and `-` signs on the integer representations have the effect of next/previous float values. Showing eps(x) would still be handy.