Live data from Hacker News

Floating point visually explained (2017)

fabiensanglard.net

1–10 of 58 posts

Re: Floating point visually explained (2017)

#2
As someone who never learned the "dreadful notation... discouraging legions of programmers", this was really helpful! The "canonical" equation doesn't mean anything to me and the window/offset explanation does.

I'm sure the author intended to keep the article short, but I think it would benefit from more examples, including a number like 5e-5 or something. It isn't clear to me how the window/offset explains that.

Edit: to clarify, I do not understand how the floating point representation of 0.00005 is interpreted with windows/offsets.

Re: Floating point visually explained (2017)

#3

As someone who never learned the "dreadful notation... discouraging legions of programmers", this was really helpful! The "canonical" equation doesn't mean anything to me and the window/offset explanation does. I'm sure the author intended to keep the article short, but I think it would benefit from more examples, including a number like 5e-5 or something. It isn't clear to me how the window/offset explains that. Edi…

5e-5 is not really related to FP, it’s just scientific notation. The number itself is still stored as shown in the post, it’s just being printed in a more compact form.

The number after e is a power of 10:

    5e2  = 5 * 10^2  = 5 * 100 = 500
    5e-5 = 5 * 10^-5 = 5 / 100000 = 0.00005
Once you internalize this, you just read the exponent as “x zeroes to the left”.

Re: Floating point visually explained (2017)

#4

As someone who never learned the "dreadful notation... discouraging legions of programmers", this was really helpful! The "canonical" equation doesn't mean anything to me and the window/offset explanation does. I'm sure the author intended to keep the article short, but I think it would benefit from more examples, including a number like 5e-5 or something. It isn't clear to me how the window/offset explains that. Edi…

5e-5 is not really related to FP, it’s just scientific notation. The number itself is still stored as shown in the post, it’s just being printed in a more compact form. The number after e is a power of 10: 5e2 = 5 * 10^2 = 5 * 100 = 500 5e-5 = 5 * 10^-5 = 5 / 100000 = 0.00005 Once you internalize this, you just read the exponent as “x zeroes to the left”.

Scientific notation is easily seen as just floating point in base ten, though. Had the same rules about leading 1 and such. Add in significant digits, and you have most all of the same concerns.

Re: Floating point visually explained (2017)

#5

As someone who never learned the "dreadful notation... discouraging legions of programmers", this was really helpful! The "canonical" equation doesn't mean anything to me and the window/offset explanation does. I'm sure the author intended to keep the article short, but I think it would benefit from more examples, including a number like 5e-5 or something. It isn't clear to me how the window/offset explains that. Edi…

5e-5 is not really related to FP, it’s just scientific notation. The number itself is still stored as shown in the post, it’s just being printed in a more compact form. The number after e is a power of 10: 5e2 = 5 * 10^2 = 5 * 100 = 500 5e-5 = 5 * 10^-5 = 5 / 100000 = 0.00005 Once you internalize this, you just read the exponent as “x zeroes to the left”.

Scientific notation IS a floating point.

Re: Floating point visually explained (2017)

#7
post #6

I don't understand how M * 2^E (modulo small representation details) is difficult to grasp. Then you have decimal types as M * 10^E. It's certainly much clearer than the windowing and bucketing in this article.

His approach works well for me. I don't retain arbitrary facts. At least part of this is a fear that if I don't properly understand its dynamics I will misapply it, better to discard it.

The windowing explanation shows me a path from the intent of the designer through to the implementation (the algorithm). Now I can retain that knowledge.

Post reply on HN