0
$\begingroup$

I'm a physics student wondering how I can mathematically show the largest possible value of a 64-bit double. I don't want to know just the answer, since that is freely available. The equation I was shown by a professor says a machine number is represented as $s\times m \times 2^{E-e}$ with $m$ the mantissa and $e$ the bias of the exponent, but I'm not sure how to use this to show the largest possible 64-bit double. The mantissa is 52 bits long and the largest exponent is 2047. The bias is 1023. The largest exponent is reserved for infinity. The leading 1 is not stored.

$\endgroup$
7
  • $\begingroup$ There isn't enough information. You need to be told how long is the mantissa. You also need to be told the largest exponent, since maybe the actual largest, implied by the size of $m$ and the bias, is not used to represent real numbers, but it is used to represent special numbers like Inf or NaNs. A possible set of choices is this. $\endgroup$
    – plop
    Aug 26 '20 at 17:47
  • $\begingroup$ I'm told the mantissa is 52 bits and the largest exponent is 2047. @plop $\endgroup$
    – supernova
    Aug 26 '20 at 19:09
  • $\begingroup$ You will get largest number by putting the sign to be $+$, the mantissa to be $(\underbrace{11\ldots1}_{52})_2=2^{52}-1$. Then you need the actual largest exponent. Do they say what is the bias? What about if Inf and NaNs are represented? I forgot above another information that is needed. For normal numbers, is the leading $1$ stored, or is $m$ only used to store the decimals. As you can see all of this is a bunch of conventions, so many that telling you what is the largest number doesn't make a difference. $\endgroup$
    – plop
    Aug 26 '20 at 19:20
  • $\begingroup$ The bias is 1023. The largest exponent is reserved for infinity. The leading 1 is not stored. Sorry, I am a total newcomer with no idea how much of this is always the same and how much has to be specified. I appreciate your patience. And just to clarify, I need to find the largest number that can be represented, not the largest integer. @plop $\endgroup$
    – supernova
    Aug 26 '20 at 19:32
  • $\begingroup$ Those choices look like the same conventions as in IEEE 754's binary64 as they appear in the link above. The largest exponent (that represents a real number) would be $2^{1023}$. The largest mantissa $\underbrace{11\ldots1}_{52}$, which represents the number $(2^{53}-1)\cdot 2^{-52}$. Multiplying this by the maximum exponent it gives $(2^{53}-1)\cdot 2^{-52}\cdot 2^{1023}$ $\endgroup$
    – plop
    Aug 26 '20 at 19:43
0
$\begingroup$

Assuming IEEE754 64 bit format:

You have an 11 bit exponent field, a 1 bit sign field, and a 52 bit mantissa field.

The exponent field can have values from 0 to 2047. An exponent field of 0 is reserved for denormalized numbers, and an exponent field of 2047 is reserved for infinity and Not-a-number. You could say that +Infinity is the largest value, but I assume you are looking for the largest finite value. The largest exponent field for a finite value is 2046.

This format has an "exponent bias" of 1023, that is the numbers 1.0 ≤ x < 2.0 have an exponent field of 1023. So the largest value has an unbiased exponent of 2046 - 1023 = 1023, and numbers with an exponent field of 2046 are in the range $2^{1023} ≤ x < 2 \cdot 2^{1023}$.

The mantissa field is 52 bit, with an implicit leading 1 bit. So a mantissa field with a value m, 0 ≤ m ≤ $2^{52}$, means the actual mantissa is 1 + $m \cdot 2^{-52}$. The largest possible mantissa field is all bits 1 or $2^{52}-1$, this makes the largest possible mantissa $2-2^{-52}$.

Multiply with the exponent, and the largest possible number is $2^{1023} \cdot (2-2^{-52})$ or $2^{1024} \cdot (1-2^{-53})$ or $2^{1024} - 2^{971}$

$\endgroup$
2
  • $\begingroup$ Can you explain more how you found the largest mantissa to be $2-2^{-52}$? $\endgroup$
    – supernova
    Aug 27 '20 at 20:13
  • $\begingroup$ @supernova what's the highest number you can fit in (1 + a 52-bit fraction)? $\endgroup$
    – user253751
    Sep 8 '20 at 18:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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