Java中Math.round()、Math.ceil()和Math.floor()函数有何具体应用及区别?

2026-05-21 10:463阅读0评论SEO资讯
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计622个文字,预计阅读时间需要3分钟。

Java中Math.round()、Math.ceil()和Math.floor()函数有何具体应用及区别?

Math.round() 四舍五入,小数点后第一位5+正数:Math.round(11.46)=11,负数:Math.round(-11.46)=-11,小数点后第一位5+负数:Math.round(-11.68)=-12,小数点后第一位5+正数:Math.round(11.68)=12。

阅读全文