Round number to nearest integer

前端 未结 11 2134
傲寒
傲寒 2020-11-27 12:32

I\'ve been trying to round long float numbers like:

32.268907563;
32.268907563;
31.2396694215;
33.6206896552;
...

With no success so far. I

11条回答
  •  误落风尘
    2020-11-27 13:12

    For this purpose I would suggest just do the following thing -

    int(round(x))
    

    This will give you nearest integer.

    Hope this helps!!

提交回复
热议问题