tk55

java中的几种取整函数

舍掉小数取整:Math.floor(2)=2
舍掉小数取整:Math.floor(2.1)=2
舍掉小数取整:Math.floor(2.5)=2
舍掉小数取整:Math.floor(2.9)=2
负数舍掉小数取整:Math.floor(-2)=-2
负数舍掉小数取整:Math.floor(-2.1)=-3
负数舍掉小数取整:Math.floor(-2.5)=-3
负数舍掉小数取整:Math.floor(-2.9)=-3

见小数取整:Math.ceil(2)=2
见小数取整:Math.ceil(2.1)=3
见小数取整:Math.ceil(2.5)=3
见小数取整:Math.ceil(2.9)=3

负数见小数取整:Math.ceil(-2)=-2
负数见小数取整:Math.ceil(-2.1)=-2
负数见小数取整:Math.ceil(-2.5)=-2
负数见小数取整:Math.ceil(-2.9)=-2

  

*****************************************************************************************************

分类:

技术点:

相关文章:

  • 2021-11-29
  • 2021-12-24
  • 2022-01-09
  • 2022-12-23
  • 2022-12-23
  • 2021-11-19
猜你喜欢
  • 2021-11-23
  • 2021-11-23
  • 2021-11-23
  • 2021-04-08
  • 2021-11-19
相关资源
相似解决方案