a_floating_point
a_floating_point

Reputation: 31

calculating max and min expressible values for floating point number rep

i want to figure out why expressible numbers in the IEEE floating point standard is 10^+38 - -10^38 (and similarly for the +ve). most textbooks just make this statement of fact, im grappling with why. ie. how would you calc this range?

Many thanks

Upvotes: 3

Views: 7675

Answers (1)

atzz
atzz

Reputation: 18010

You are talking abount IEEE 754 single-precision (32-bit) floating point representation. In this format, maximum value of the exponent is 127. The representation is base-2, thus maximum possible value is about 2^127. Let's convert it to decimal: 127 * log(2) / log(10) ≈ 38.23. That's why max value representable by a 32-bit float is approx. 10^38. You can find more details on the IEEE 754 floats in the linked Wikipedia article.

Upvotes: 3

Related Questions