필터 지우기
필터 지우기

on the meaning of doubles ...

조회 수: 1 (최근 30일)
Seetha Rama Raju Sanapala
Seetha Rama Raju Sanapala 2014년 7월 19일
답변: dpb 2014년 7월 19일
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

채택된 답변

dpb
dpb 2014년 7월 19일
Actually, IEEE-754 is 53 bit mantissa. For all the gory details see...

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by