Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Float Exposed (float.exposed)
66 points by nint22 on Nov 26, 2018 | hide | past | favorite | 6 comments


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


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.


This is really nice! It'll come in very handy for my next training class -- students are always asking why they shouldn't use floating point for money and I always explain it, but having a tool where they can play around with it is much better.


This is really cool!

I believe this uses IEEE https://en.wikipedia.org/wiki/IEEE_754? An additional cool feature would be the ability to toggle between this, and other standards such as DEC64 and UNUM.


Very cool to quickly estimate the errors in certain number regions.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: