Strange (lack of) round-off error using norm
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
David Goodmanson
am 17 Feb. 2019
Hi Mariano
I ran this on my PC and got
ans = 409f400000000001
ans = 409f400000000001
Not sure what to say .....
Antworten (1)
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!