on the meaning of doubles ...

3 views (last 30 days)
Seetha Rama Raju Sanapala
Seetha Rama Raju Sanapala on 19 Jul 2014
Answered: dpb on 19 Jul 2014
I have copy pasted below a piece from MATLAB documentation.
Numbers represented in the double format have a maximum precision of 52 bits. Any double requiring more bits than 52 loses some precision. For example, the following code shows two unequal values to be equal because they are both truncated: x = 36028797018963968; y = 36028797018963972; x == y ans = 1
Integers have available precisions of 8-bit, 16-bit, 32-bit, and 64-bit. Storing the same numbers as 64-bit integers preserves precision: x = uint64(36028797018963968); y = uint64(36028797018963972); x == y ans = 0
My question is this.
>> 2^52
ans =
4503599627370496
If you use double for any numbers greater than 2^52 as above, loss of precision and similar problem like in the documentation should occur. I checked but it does not occur as shown as below. Why?
x =
4503599627370500
y =
4503599627370501
x==y
ans =
0

Accepted Answer

dpb
dpb on 19 Jul 2014
Actually, IEEE-754 is 53 bit mantissa. For all the gory details see...

More Answers (0)

Categories

Find more on Multidimensional Arrays in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!