Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Single-precision floating-point format Range

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.

like image 401
Manu Thakur Avatar asked Dec 21 '25 18:12

Manu Thakur


1 Answers

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

like image 67
Nayuki Avatar answered Dec 24 '25 11:12

Nayuki



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!