sprintf bug?
1 次查看(过去 30 天)
显示 更早的评论
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..
0 个评论
采纳的回答
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Numeric Types 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!