Should the exponent be larger than or equal 2^52 for the 64 bit floating point to be an integer irrespective of the value of the mantissa

时间:2016-08-31 17:22:09

标签: binary floating-point ieee-754

I'm trying to understand if the exponent should be larger than 2^52 for the 64 bit floating point to always get integer. It seems so to me. Here is my reasoning:

If mantissa has 52 bits, then the number stored is the following:

1.0000000000000000000000000000000000000000000000000000

then we need to move the floating point to the right 52 places to get an integer. If we move it less number of places, for example, 51, then we can end up with a fractional part. For example, for the number

1.0000000000000000000000000000000000000000000000000001 x 2^51

it will be

2251799813685248.5

It seems that to get an integer we need to move the floating point by the number of places depending where the last value 1 is found. For example, if it's in the 30th bit, then we need to have an exponent equal to 30 (230).

Is my logic correct?

0 个答案:

没有答案