On 18/07/2010 12:27, Aaron Lewis wrote:
> Hi,
>       how can i determine the maximum size of `double' without printing out
> DOUBLE_MAX ?
>
>       And what about the precision of a `double' , anyone give a try ?
>
>       Google ain't giving much information , i just can't figure out , it's
> very funny coding , isn't it ?
>

Kinda off-topic for here but whatever...

Assuming 64-bit double, it has a mantissa of 52 bits and an exponent of
11 bits. If the mantissa is all-ones, that will give a significant of
2-2^(-52).  The exponent cannot be all-ones (an all-ones exponent means
infinity or NaN), so the largest exponent is 2^11-2 = 2046, minus bias
(1023), it gives a maximum effective exponent of 1023, so that would
give a value of (2-2^(-52))*2^(1023) = 2^1024 - 2^971, roughly 10^308.

What do you mean by "precision"?

Firas

Reply via email to