Filter löschen
Filter löschen

on the meaning of doubles ...

1 Ansicht (letzte 30 Tage)
Seetha Rama Raju Sanapala
Seetha Rama Raju Sanapala am 19 Jul. 2014
Beantwortet: dpb am 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

Akzeptierte Antwort

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

Weitere Antworten (0)

Kategorien

Mehr zu Multidimensional Arrays finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by