A fun tool to explore or teach floating point numbers

I have found this site on Mastodon:

Very interesting for teaching what is a floating point real! You can for example click on each bit and show how is represented Infinity or NaN, etc.

9 Likes

Super helpful, thanks for sharing.

1 Like

At the bottom of the page, you can click on the name of the author and be redirected to this article on his blog:

See also his other articles:
https://ciechanow.ski/archives/

Very beautiful blog!

1 Like

Thanks for sharing. I find it strangely intriguing and philosophical how the number 1.0 and “Infinity” differ by just one bit.

1.0: 0011 1111 1000 0000 0000 0000 0000 0000
Inf: 0111 1111 1000 0000 0000 0000 0000 0000
2 Likes

With that fact and e^{\mathrm i\pi}+1=0, you “hold Infinity in the palm of your hand”. :face_with_spiral_eyes:

A more prosaic view is that it is so because the first 1 of a not null significand is implicit in IEEE 754 (the art of gaining 1 bit!).

With 32 bits:
42 is 0 10000100 01010000000000000000000. No fun… :roll_eyes: