Re:Celebrate 50 years of Microsoft with the company's origin...
by WalterBright on Friday April 04, 2025 @04:17PM
(#43587196)
In other words, a floating point number consists of 2 numbers and a sign bit:
1. the digits
2. the exponent
3. a sign bit
If you're familiar with scientific notation, yes, it's the same thing.
https://en.wikipedia.org/wiki/Scientific_notation
The rest is just the inevitable consequences of that.
Re:Celebrate 50 years of Microsoft with the company's origin...
by codedokode on Friday April 04, 2025 @05:12PM
(#43587645)
I like "decimal point position" more than "exponent". Also, if I remember correctly, "mantissa" is the significand (the digits of the number).
And by the way engineering notation (where exponent must divide by 3) is so much better. I hate converting things like 2.234·10¹¹ into billions in my head.
And by the way (unrelated to floating point) mathematicians could make better names for things, for example instead of "numerator" and "denominator" they could use "upper" and "lower number". So much easier!
Re:Celebrate 50 years of Microsoft with the company's origin...
by WalterBright on Friday April 04, 2025 @07:15PM
(#43588725)
I do get significand and mantissa mixed up. I solved that by just removing them!
With fixed point numbers, you write the digits into the memory and have a convention that the decimal point is always after N-th digit. For example, if we agree that the point is always after 2-nd digit then a string 000123 is interpreted as 00.0123 and 123000 means 1230. Using this system with 6 digits we can represent numbers from 0 to 9999 to precision of 0.01.
With floating point, you write both decimal point position (which we call "exponent") and digits (called "mantissa"). Let's agree that the first two digits are the exponent (point position) and the rest four is mantissa. Then this number:
means 01.23 or 1.23 (exponent is 2 meaning the decimal point is after 2nd digit in mantissa). Now using same 6 digits we can represent numbers from 0 to 9999·10⁹⁶ with relative precision of 1/10000.That's all you need to know, and the rest should be easy to figure out.