
Floating Point Visually Explained (2017) - mercer
http://fabiensanglard.net/floating_point_visually_explained/index.php
======
svat
See also:

* [https://float.exposed/](https://float.exposed/) (companion blog post: [https://ciechanow.ski/exposing-floating-point/](https://ciechanow.ski/exposing-floating-point/))

* [http://www.toves.org/books/float/](http://www.toves.org/books/float/)

(Reproducing from another discussion a month ago:
[https://news.ycombinator.com/item?id=18832155](https://news.ycombinator.com/item?id=18832155))

~~~
userbinator
One of my favourite sites for explaining floating-point, especially the more
subtle aspects, is
[https://www.exploringbinary.com/](https://www.exploringbinary.com/) . Here's
a similar article from that site:

[https://www.exploringbinary.com/the-spacing-of-binary-
floati...](https://www.exploringbinary.com/the-spacing-of-binary-floating-
point-numbers/)

------
jstanley
I think this explanation still makes it harder than it needs to be. Just
imagine what a "floating point" number would mean in decimal: you get (say) 5
adjacent digits to play with, and you get to choose where you put the decimal
place, within a limited range.

So you can represent 12345000 or 12.345 or 0.00012345.

But 12345600 rounds to 12346000, 12.3456 rounds to 12.346, and 0.000123456
rounds to 0.00012346.

------
mekane8
This is an awesome explanation, thanks for sharing! I remember struggling
mightily in college to understand Floating Point, and my professor never
offered anything other than the mathematical formula explanation. That never
really helped me understand how the computer is actually dealing with these
numbers, but this step-by-step explanation really clicked.

------
mark-r
Intel's floating point coprocessor may have been out of reach for most people
in the early 90's, but there were clones available. My 386 had a Cyrix I
believe.

~~~
canada_dry
> My 386 had a Cyrix I believe.

Yup... and as I recall, it was a must have for MS flight sim and Falcon 3!

~~~
rasz
nope, ms sim didnt use fpu, falcon 3 had a separate, optional "realistic" hi-
fidelity flight model that used fpu, but it was pretty broken
[http://simhq.com/forum/ubbthreads.php/topics/3803136/re-
falc...](http://simhq.com/forum/ubbthreads.php/topics/3803136/re-
falcon-3-0-joystick-sensitivity-problem-in-hi-fidelity-flight-
model#Post3803136)

------
hopler
I don't understand how the pictures help. The core formula is compact, but
that doesn't make it bad. A few sentences of explanation is great for people
who haven't learned standard high-school-level math notation or who want a
walkthrough as a refresher (so thanks tonthr author for writing it down ), but
refusing to learn math notation is going to make learning every math concept
harder, penny wise and pound foolish. I don't see how this blog post/book
chapter's explanation is novel as it claims to be, or why every other
explanation of floating point is supposedly poor. I suspect it's just a matter
of learning concepts requires thinking, so thrilled author jotted notes while
he was thinking, and misattributed his progress to the specific visuals and no
to the process of thinking about the formula.

The hard part of floating point isn't the representation of numbers, it's how
to perform arithmetic with rounding/truncation in the specified way (and why
the specified way is preferred). The blog post doesn't touch on that at all.

~~~
_jsdw
Personally, I might be able to convert a number to floating point using the
formula, but it's not easy to grasp why. The visual explanation really helps
with that.

Being able to read maths doesn't automatically mean that it is the best way to
present an explanation of something.

------
dang
Discussed at the time:
[https://news.ycombinator.com/item?id=15359574](https://news.ycombinator.com/item?id=15359574)

------
joe4322353
Some might be mistaken this post is from fabrice bellard just like me, it it
not. The web address might be a little bit confusing. This is not a post by
fabrice bellard the guy who initiated ffmpeg project among many others.

------
sephoric
My son and I have been trying to understand floating point numbers with almost
no success, since it's usually explained with arcane mathematical symbols that
neither of us understand. This page is brilliant and I'm going to show this to
him, after editing the hilarious image with the owl. Why is profanity
necessary to convey intensity? It's 2019, surely we have better ways of doing
so by now.

~~~
velp
Serious question - why get so bothered by it? If he's old enough to be
thinking about floating point numbers, he's definitely heard the word, and
it's not especially gratuitous in this instance. Might be a good opportunity
to discuss how word choice is dependent on context.

~~~
jake_the_third
> Serious question - why get so bothered by it?

Same reason why many people refuse to visit nude beaches despite others not
seeing any issue in said these beaches: personal values and principles.

