필터 지우기
필터 지우기

How can I know if MATLAB is using 64 bit double precision?

조회 수: 14 (최근 30일)
Patricia
Patricia 2014년 4월 10일
댓글: Walter Roberson 2014년 4월 11일
Hi, I'm doing a numerical integration to propagate the trajectories of the bodies in our solar system. I am not a computer science person so I am not even sure that my question makes any sense. I need to make sure that MATLAB is using 64 bit double precision. I read somewhere that matlab always uses 64 bits but when I type "digits" into the command window, I get 32. Also the value of eps is 1e-16. As far as I understood, for 32 bits, the unit roundoff or machine precision is 1e-7. So I guess my question is what is the difference between the information given by number of bits and the machin precision?
If anyone can help me out with this I would be most grateful :-)
Thanks

답변 (3개)

Alberto
Alberto 2014년 4월 10일
편집: Alberto 2014년 4월 10일
If you want all numeric results appear in 64 bits, you have to use:
float('double')
float('long')
  댓글 수: 1
John D'Errico
John D'Errico 2014년 4월 11일
편집: John D'Errico 2014년 4월 11일
This would have nothing to do with the computations. In fact, the commands you have advised for use will generate an error in MATLAB.
Finally, I would point out that MATLAB knows nothing at all about a long data type.

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


Jan
Jan 2014년 4월 10일
Matlab's double 's have a precision of 64 bits. The 32 bit floating point type is single. digits is related to the different topic of symbolic maths. This means the number of digits, not bits.
For numerical integrations you can rely on the fact, that Matlab uses double precision if the initial values have this type also.
  댓글 수: 3
Patricia
Patricia 2014년 4월 11일
So there is no link between digits and bits? And if I understood correctly, as long as my initial conditions are doubles then matlab will use double precision for everything else?
Thanks a lot for the help
Walter Roberson
Walter Roberson 2014년 4월 11일
There are multiple possible relationships between digits and bits. For the one that MATLAB uses for double precision numbers, please have a look at IEEE 754 Floating Point standards.
If N bits are stored for the mantissa in floating point schemes that use "hidden bit", then the number of digits is between floor(log10(2^(N+1))) and ceil() of the same expression.

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


Alberto
Alberto 2014년 4월 10일
Actually, I don't know if that changes how the computations are made, or how the results are shown.
  댓글 수: 1
Walter Roberson
Walter Roberson 2014년 4월 11일
float('double') would request to convert the string ['d' 'o' 'u' 'b' 'l' 'e'] to single precision floating point and output the result. It would not change anything.
There are some feature() commands that might have effect.

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

카테고리

Help CenterFile Exchange에서 Numbers and Precision에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by