How to force MATLAb to use 32bit floating-point numbers in a script?

조회 수: 31 (최근 30일)
Mr M.
Mr M. 2018년 4월 17일
댓글: dpb 2018년 4월 17일
Is it possible to use 32bit precision thru a script or part of the script without editing the whole code?
  댓글 수: 2
John D'Errico
John D'Errico 2018년 4월 17일
No. You cannot simply tell MATLAB to change precision from outside the code.
dpb
dpb 2018년 4월 17일
On top of which, you can't define a default precision for a script within a script or function file; you can only cast to a given precision on assignment and then ensure all variables in all related calculations are also of same class or follow other strict rules to avoid results being default doubles.

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

답변 (1개)

Walter Roberson
Walter Roberson 2018년 4월 17일
편집: dpb 2018년 4월 17일
  댓글 수: 1
dpb
dpb 2018년 4월 17일
Doesn't it only control the rounding mode? I couldn't demonstrate to my satisfaction that it actually did anything discernible in R2016b here; seems like in times gone by one could see the effect but I've forgotten the details of how/what did those many years ago...
I'm presuming the OP wants to actually have everything only take up single precision in memory as well???

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

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by