Floating Points

Not necessarily how to convert them, but more like how they're represented in computer systems where storage space (in bits) is finite. The IEEE-754 standard was made to store floating point numbers in such a way that they can be represented accurately by the computer but still only take up 32bits of space (single precision) or 64bits of space (double precision).

Some good info:
General info here: IEEE floating point - Wikipedia, the free encyclopedia
A better representation/example: IEEE 754-1985 - Wikipedia, the free encyclopedia
And here's a nice online calculator that I've used before when trying to learn converting from IEEE-754 to decimal: http://babbage.cs.qc.cuny.edu/IEEE-754.old/32bit.html
 
Sorry for the late reply but I couldn't fully understand the "mantissa times 2^x, where x is the exponent".
 
Sorry for the late reply but I couldn't fully understand the "mantissa times 2^x, where x is the exponent".

This link explains it:
IEEE 754-1985 - Wikipedia, the free encyclopedia

When the binary is written out (in the example in the link, 0.00101), you move the decimal point X number of times until you put it in "scientific notation" (1 leading digit before the decimal), which is then called the mantissa. Then, you write out 2^X.

Because like scientific notation, you'd write out something like 0.00123 as:
1.23 * 10^-3, because it's in decimal (base 10). But since you're dealing with binary (base 2) with IEEE-754, it's mantissa * 2^X.
 
Thanks so looking at it,

Say i have the number 0.00000014123

Would be 1.4123 * 2^-5?

Well...depends. If you're just converting to scientific notation, that's 1.4123 * 10^-7

If you're working on converting to IEEE-754, then you're doing step 2 wrong.

You're working in base 10, and you were off by 2 decimal places.

Here's a step-by-step example on converting decimal->IEEE-754:
IEEE 754 tutorial: Converting to IEEE 754 Form

And here's binary string to IEEE-754:
IEEE 754 tutorial: Converting to IEEE 754 Form
 
Last edited:
Couldn't have been given any better examples, but when you devide the number by 2 to the power etc, it has 2^-1, 2^-2, etc.

Is that how it is for every number or does it depend on the sign bit (The -1, -2, -3, etc).
 
the 2^-1, 2^-2, ... etc. doesn't deal with the sign bit. You're using negative exponents because you're dealing with fractional parts.

Notice in the example that the number is positive, so it wouldn't really make sense to use negative exponents if it was related to the sign bit.

Here's another example: IEEE 754 Format | The Oxford Math Center
Notice in step 4 in the grayish box how it tells you when to stop for that step (once it begins repeating a pattern).

It's been a while since I've done IEEE-754 conversions, so I'm a bit rusty :p.
 
Back
Top Bottom