Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

preciseness of the calculation

조회 수: 1 (최근 30일)
bahare
bahare 2011년 11월 18일
마감: MATLAB Answer Bot 2021년 8월 20일
Hi I have two rows of data, consists of 3 numbers in each row. which are for example a,b and c. a and c are constant in each row, but b is changed. I sum the numbers in each row, however the answers are the same even though b is different. here is the numbers: a= 9237639,3400267 b=184,279078050855 c=23,3803295791066 a+b+c= 19237846,9994343 a=19237639,3400267 b=184,279078052863 c=23,3803295791066 a+b+c= 19237846,9994343
why these two summations are different?

답변 (1개)

Jan
Jan 2011년 11월 18일
This is an effect of the limit internal precision. DOUBLEs are represented by 64 bits such that the mantissa has a precision of 53 bits. This is about 16 digits. If you add numbers of different size, small differences can dissappear. See:
a = 1.0E17 + 1 - 1.0E17
% >> 0
although 1 would be mathematically correct. But the intermediate result of the first two summands cannot be represented accurately.
Using the standard IEEE arithmetics, there must be a difference between "mathematically" and "numerically". See also: eps and FAQ 6.1.
BTW. Reading the FAQ completely is always a good idea.

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by