Strange (lack of) round-off error using norm
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello,
I have found this behaviour:
>> format hex
>> p=[sqrt(2) sqrt(2)]*1e3;
>> sqrt(sum(p.^2))
ans =
409f400000000001
>> norm(p)
ans =
409f400000000000
I understand the round-off error using sqrt. What I do not understand is how does norm do to avoid it.
Thanks,
Mariano
댓글 수: 2
David Goodmanson
2019년 2월 17일
Hi Mariano
I ran this on my PC and got
ans = 409f400000000001
ans = 409f400000000001
Not sure what to say .....
답변 (1개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!