필터 지우기
필터 지우기

Strange (lack of) round-off error using norm

조회 수: 2 (최근 30일)
Mariano
Mariano 2019년 2월 16일
답변: Mariano 2019년 2월 17일
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
David Goodmanson 2019년 2월 17일
Hi Mariano
I ran this on my PC and got
ans = 409f400000000001
ans = 409f400000000001
Not sure what to say .....
Walter Roberson
Walter Roberson 2019년 2월 17일
R2018b on my Mac, I do see the different values.

댓글을 달려면 로그인하십시오.

답변 (1개)

Mariano
Mariano 2019년 2월 17일
I should have said version and computer:
R2018b on Windows 64bits.

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by