round-off issue?
1 次查看(过去 30 天)
显示 更早的评论
I can't figure out why the floor wont come to 1752?
>> 3.501/40*20*10^3+1.5
ans =
1.752000000000000e+003
>> floor(ans)
ans =
1751
0 个评论
采纳的回答
Fangjun Jiang
2011-9-20
Rounding error caused by floating point calculation.
>> 3.501/40*20*10
ans =
17.504999999999995
2 个评论
Jan
2011-9-20
sprintf('%.13f', 3.501/40*20*10^3+1.5)
>> 1751.9999999999998
sprintf('%.12f', 3.501/40*20*10^3+1.5)
>> 1752.000000000000
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!