Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I was going through this SO post on Math.random() vs Random.nextInt(int) and encountered the following line :

Random.nextDouble() uses Random.next() twice to generate a double that has approximately uniformly distributed bits in its mantissa, so it is uniformly distributed in the range 0 to 1-(2^-53).

From the Wikipedia link on Significand:

In American English, the original word for this seems to have been mantissa (Burks et al.), and as of 2005 this usage remains common in computing and among computer scientists. However, this use of mantissa is discouraged by the IEEE floating-point standard committee and by some professionals such as William Kahan and Donald Knuth,[citation needed] because it conflicts with the pre-existing use of mantissa for the fractional part of a logarithm (see also common logarithm).

What does mantissa actually mean here ? How is the range coming out to be 0 to 1-(2^-53)?

share|improve this question

3 Answers 3

up vote 4 down vote accepted

If I understand you correctly, you are asking about the meaning of "mantissa" in the context of floating point numbers, right?

In floating point arithmetics, a number is represented as $(-1)^s\cdot m\cdot 2^e$ with $s\in\{0,1\}$, $m\in[0.5,1)$ and $e\in \mathbb Z$. The number $m$ is called the mantissa, $s$ the sign bit, and $e$ the exponent. (Of course, for general reals, only an approximation of $m$ is stored (more specifically, $m$ can only be an integer multiple of some number $\epsilon$ called machine epsilon), and the exponent can only be in a specific range, because the memory where the floating point number is stored is finite. The difference between different precision floating point format is exactly how many bits of the mantissa are stored, and which range for the exponent is supported. Especially, for IEEE double precision, the mantissa is 53 bits, that is, $\epsilon = 2^{-53}$).

Note that when represented in binary, the mantissa always looks like $0.1n_2n_3n_4\dots$, therefore usually only the bits $n_2$, $n_3$, … are stored. Note that this implies that you have to use a special format to store $0$, this is done by reserving a specific exponent for that (for some floating point formats, including the IEEE formats, the same exponent is also used to denote other so-called denormalized numbers, that is, numbers where the implicit one-bit is not in the mantissa; the numbers are called "denormalized" because the mantissa is not in the proper range).

share|improve this answer
Strictly speaking, the mantissa includes the leading $1$, but it is also true that in IEEE 754, the leading $1$ is omitted when possible. –  Zhen Lin Aug 20 '12 at 13:55
@ZhenLin: Yes, as I wrote, the mantissa is $m$, which includes the $1$, (note that I explicitly wrote "the mantissa looks like $0.1n_2n_3n_4\dots$"), but what is stored are in general only the other bits. –  celtschk Aug 20 '12 at 14:02

A floating point number $x$ is stored in two parts, the mantissa $m$ and the exponent $p$ so that x = $m \times 2^p$. The IEEE standard requires that we adjust the exponent (move the decimal point left or right) so that the mantissa is always in $[0,1)$. The range of $m$ is $0$ to $1-(2^{-53})$ because the mantissa of a 64-bit floating point number is 53 bits. This makes sure that the same number is represented consistently. I am glossing over some of the details of how exactly it is stored in memory and converted to decmial.

share|improve this answer

The intrnal part is written before the decimal and it is called the characteristic while the fractional part written after the decimal is called the mantissa..

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.