HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

What is 0.1 converted to 8bit IEEE754?

Submitted by: @import:stackexchange-cs··
0
Viewed 0 times
ieee7548bitwhatconverted

Problem

0.1 via $32\text{ bit}$ is rather easy:

Sign: $0_2 = 0_{10}$

Exponent: $123_{10} = 01111011_2$

Mantissa: $5033165_{10} = 100110011001100110011001101_2$

Now, how do you calculate this, if you've only $8\text{ bit}$ available?

Sign: $1\text{ bit}$, Exponent: $2\text{ bit}$, Mantissa: $5\text{ bit}$

My idea: $S=0; E=01; M=00001$

What do you think?

Solution

For $8$-bit floating point, you should look at $A$-law and $\mu$-law encoding standards:

http://en.wikipedia.org/wiki/%CE%9C-law_algorithm

http://en.wikipedia.org/wiki/A-law_algorithm

Depending on your input range, you may need some scaling.

Context

StackExchange Computer Science Q#37858, answer score: 2

Revisions (0)

No revisions yet.