Math.ceil and Math.floor returning same value

前端 未结 5 716
萌比男神i
萌比男神i 2020-12-31 00:31

I have a double (23.46)

And using the methods Math.ceil and Math.floor and parsing my double to these methods, I get the same value returned to me, which is 23...

5条回答
  •  一向
    一向 (楼主)
    2020-12-31 01:35

    When I run

    System.out.println(Math.ceil(23.46));
    System.out.println(Math.ceil(15.01));
    

    I get

    24.0
    16.0
    

    Isn't that what you want?

提交回复
热议问题