3 ms·
A useful website for these that I ran across recently: https://float.exposed/ https://float.exposed/ For example, entering 9999999999999999.0 into "double" giv
by svat 8y ago
A useful website for these that I ran across recently: https://float.exposed/ https://float.exposed/
For example, entering 9999999999999999.0 into "double" gives https://float.exposed/0x4341c37937e08000 https://float.exposed/0x4341c37937e08000 and entering 9999999999999998.0 gives https://float.exposed/0x4341c37937e07fff https://float.exposed/0x4341c37937e07fff
My wishlist for such a page would contain two additional features:
1. Allow entering expressions like "a OP b == c", so that one can enter "0.1 + 0.2 == 0.3" or "9999999999999999.0 - 9999999999999998.0 == 1.0" and see the terms on the left-hand side and right-hand side.
2. Show for each float the explicit actual range of real numbers that will be represented by that float. For example, show that every real number in the range [9999999999999999, 10000000000000001] is represented by 10000000000000000, and that every real number in the range (9999999999999997, 9999999999999999) is represented by 9999999999999998.
The author of this one has a blog post about it: https://ciechanow.ski/exposing-floating-point/ https://ciechanow.ski/exposing-floating-point/ and I also like a shorter (unrelated) page that nicely explains the tradeoffs involved in floating-point representations and the IEEE 754 standard, by usefully starting with an 8-bit format: http://www.toves.org/books/float/ http://www.toves.org/books/float/
- scrollaway 8y agoOT: What a lovely tld .exposed is. I… really wonder about its majority userbase.
- deleted 8y ago[deleted]
- DougBTX 8y ago> 9999999999999999.0 into "double" gives https://float.exposed/0x4341c37937e08000 https://float.exposed/0x4341c37937e08000 Nice that it reformats the input to "10000000000000000.0", gets the point across that a 64 bit double float just doesn't have enough bits to exactly represent 9999999999999999.0, but that it does happen to be able to represent 9999999999999998.0.
- loeg 8y agoAn easy rule of thumb is each 3 decimal digits takes 10 bits to represent. 9999999999999999 is 16 (= 15 + 1) decimal digits. And 3 bits can only represent 0-7. So you need more than 3 bits for that final decimal digit. So, 50 + 4 bits. IEEE 754 64-bit floats have 53 significant bits ("mantissa").
- csours 8y agoThis is awesome, I tried to read and understand the 754 float spec before, and I didn't really get it. Try playing around with half precision, it makes things a lot easier to understand.
- tzs 8y agoThe IEEE 754 calculator at http://weitz.de/ieee/ http://weitz.de/ieee/ does some of what you ask for. You can enter two numbers, see the details of their representation, and do plus, minus, times, or divide using them as operands and see the result.