sprintf bug?

조회 수: 2 (최근 30일)
oguz sen
oguz sen 2011년 10월 7일
I run the following lines to reformat my integer data into string sprintf('%024.0f',1000010000000000000000);
and i expect the result to be
001000010000000000000000
but it's 001000009999999999900000
can someone explain this?
thanx in advance..

채택된 답변

Laura Proctor
Laura Proctor 2011년 10월 7일
It has to do with the size of the value you are entering; it is larger than the largest integer-valued floating-point number (2^52) allowed. It is being resolved to the value that you are seeing as the output.
  댓글 수: 1
Jan
Jan 2011년 10월 7일
2^53-1, see BITMAX. http://www.mathworks.de/support/tech-notes/1100/1108.html

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

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by