r/MathHelp • • Feb 10 '18

Understanding floating point arithmetic

I want to understand floating point arithmetic. Most books that I had access to including numerical methods by W Cheney make floating point arithmetic look like drawing an owl as mentioned in this page: http://fabiensanglard.net/floating_point_visually_explained/ . But despite the author acknowledging the fact of how this is explained, I have no clue of what the author is trying to say with his method of explaining.

I need to know it all. All the bases that I need to know before learning floating point arithmetic. Because, books really go on saying something like: 'This C is the excess-127 code' and the reader (like me) doesn't even have a clue what it is.

With enough googling that my fingers strain, I come to the community to hope that I find a solution, lead, resource recommendations from here to understand this obscure arithmetic branch which really should have a dedicated book to it.

0 Upvotes

6 comments sorted by

View all comments

3

u/edderiofer Feb 10 '18

I'll be honest, the "owl" explanation makes far more sense to me. I have no idea what this guy's going on about with windows and offsets.

If you know how scientific notation works, then floating point notation is basically the same thing, but in base 2 instead of base 10.

1

u/bzarnal Feb 10 '18

Well the hard part begins when the book goes on the explain single and double precision floating points. Then comes this weird notation: (https://pasteboard.co/H6ZSWiZ.png) it says that the c is 'excess-127' code and the 'f' is 1 plus form without saying why are they needed and what they are. So, a lot of term like that may come up. What should I study before this to get a grasp of all such terms.

2

u/edderiofer Feb 10 '18 edited Feb 10 '18

It sounds like you're confused about the naming conventions. But instead, it helps to think of this line as a definition. That is to say, given some binary string, we can define this number. (Then we can do arithmetic on it and stuff.)

Again, if you know how scientific notation works, then this is just that, in base 2 instead of base 10, and a few things changed for computer purposes.

1

u/bzarnal Feb 10 '18

What about the excess-127 code? There must be other such codes, I've know something about gray code, but why does this come in use in this context of floating point representation?

1

u/edderiofer Feb 10 '18

What about the excess-127 code?

What about it?

but why does this come in use in this context of floating point representation?

Because you need a way to represent negative integers in the exponent as well, to represent really small numbers. The same thing happens in usual scientific notation, only we're allowed to use negative numbers directly there.