Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the maximum number in the mantissa part of a Java float?

Tags:

java

In Java what is the maximum number in the mantissa part that can be stored?

In this link below http://steve.hollasch.net/cgindex/coding/ieeefloat.html

                         Sign       Exponent    Fraction    Bias
Single Precision       1 [31]       8 [30-23]   23 [22-00]  127

Does it mean that we can have only 0 to 2^8 combinations stored?

like image 631
user733434 Avatar asked May 01 '11 16:05

user733434


2 Answers

Everything you want to know is on the wikipedia page for IEEE-754: http://en.wikipedia.org/wiki/IEEE_754-2008.

like image 154
bmargulies Avatar answered Sep 22 '22 23:09

bmargulies


The mantissa is 23 bits in a float, but the stored value is normalized, meaning that there's an implied leading 1 followed by a decimal point. This takes it to 24 effective bits.

like image 33
Bill the Lizard Avatar answered Sep 18 '22 23:09

Bill the Lizard