Reputation: 355
Sign = 1 bit, Biased Exponent = 8 bits, Mantissa = 23 bits
What is the positive and negative possible range? My teacher told me the following range for ieee 754:
-0.5*2^-128 to -(1-2^-24)*2^127 (for negative floating point numbers)
0.5*2^-128 to (1-2^-24)*2^127 (for positive floating point numbers)
But I don't find this range correct because I am not able to understand how to store 0.5 * 2-128 into this format. Please explain.
Upvotes: 3
Views: 10250
Reputation: 18542
Firstly, the floating-point number format is symmetric for positive and negative numbers. So we will only look at the positive case.
The maximum positive number has the maximum mantissa 1.111111111111111111111112 and maximum non-infinite exponent 127. Thus 1.111111111111111111111112 × 2127 = (2 − 2−23) × 2127 ≈ 3.402 × 1038 ≈ 2128.
The minimum positive number has the non-zero mantissa 0.000000000000000000000012 and the minimum exponent −126 for subnormal/denormalized numbers. Thus 0.000000000000000000000012 × 2−126 = 2−23 × 2−126 = 2−149 ≈ 1.401 × 10−45.
Further reading: https://en.wikipedia.org/wiki/Single-precision_floating-point_format
Upvotes: 5