필터 지우기
필터 지우기

difference between .01 and 0.01 in matlab?

조회 수: 12 (최근 30일)
Rapheal
Rapheal 2012년 5월 11일
Hi!
pls whats the difference between .01 and 0.01 in matlab?
thanks

답변 (4개)

Richard Brown
Richard Brown 2012년 5월 11일
Readability

John D'Errico
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

Image Analyst
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

Rapheal
Rapheal 2012년 5월 12일
im confused because i tried it on 2 different computers with different versions of matlab. On the computer that had Matlab 2012 there was an error while in the other computer with matlab 2007 it ran smoothly.
  댓글 수: 2
Image Analyst
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)?
Walter Roberson
Walter Roberson 2012년 5월 12일
What is it that you tried, and what error message resulted?

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

카테고리

Help CenterFile Exchange에서 Scripts에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by