2 ms·
The difficulty, I think, is folks thinking that .2 would be as small of a value as 2? That is, showing the bias in how it goes for the exponent increases is th
by taeric 3y ago
The difficulty, I think, is folks thinking that .2 would be as small of a value as 2? That is, showing the bias in how it goes for the exponent increases is the point. 1e2 is easy for folks to intuit with decimal. As soon as that exponent is to a 2, things get odder. (In particular, I wouldn't be shocked for most peoples intuition that 8 is represented using 100e0 in floats, when I would expect it is 1e11. Right?)
Edit: I should say that I realize this isn't the actual exponent bias. I do think this is what would trip up most people, though?
- a_e_k 3y agoYep. And C and C++ now have a hexfloat format that lets you write a float exactly in terms of the mantissa and exponent. For the value `8.0`, you can write it as `0x1p3`. (It's kind of weird in that the unbiased exponent is in decimal while the mantissa is in hex, so `1024.0` could be written `0x1p10`.) The printf/scanf specifier, by the way, is `%a`.
- taeric 3y agoThanks! I was actually surprised at not knowing how to get that representation. In particular, I was surprised that Common Lisp has a way to get binary for integers, but I don't see how to get the float binary printed out. Granted, I don't imagine this comes in necessary that often.