difference between .01 and 0.01 in matlab?
10 ビュー (過去 30 日間)
古いコメントを表示
Hi!
pls whats the difference between .01 and 0.01 in matlab?
thanks
0 件のコメント
回答 (4 件)
John D'Errico
2012 年 5 月 11 日
Um, zero. As far as MATLAB is concerned, the two are identical. To prove that, I'll do this:
>> hex = sprintf('%bx',0.01)
hex =
3f847ae147ae147b
>> hex = sprintf('%bx',.01)
hex =
3f847ae147ae147b
So the two numbers in hex form are identical. Or look at them using HPF.
DefaultNumberOfDigits 60
hpf(0.01)
ans =
0.0100000000000000002081668171172168513294309377670288085937500
hpf(.01)
ans =
0.0100000000000000002081668171172168513294309377670288085937500
0 件のコメント
Image Analyst
2012 年 5 月 11 日
Just a leading zero but essentially they are the same - subtracting them will give a perfect zero (I tried/verified). Perhaps you're thinking of this: http://matlab.wikia.com/wiki/FAQ#Why_is_0.3_-_0.2_-_0.1_.28or_similar.29_not_equal_to_zero.3F
0 件のコメント
Rapheal
2012 年 5 月 12 日
2 件のコメント
Image Analyst
2012 年 5 月 12 日
Tried WHAT on two different computers? What was the error (make sure you copy and paste all the red error text)?
参考
カテゴリ
Help Center および File Exchange で Debugging and Analysis についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!