how to round 10.5 to 10 ?
3 次查看(过去 30 天)
显示 更早的评论
hello I want to round down from 10.5 to 10 is there a command for this operation ?
1 个评论
Walter Roberson
2018-7-3
Is the question about the rounding of values that end in 0.5 exactly, since round() typically rounds those up?
回答(2 个)
Asit Kumar
2018-7-4
both fix and floor will give the same answer for positive decimal numbers (if your intention is to round down regardless the decimal value)
But they will produce different results for negative decimals:
1. fix
fix rounds towards 0
fix(10.5) = 10
fix(-10.5) = -10
2. floor
floor rounds towards negative infinity
floor(10.5) = 10
floor(-10.5) = -11
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!