I am computing some values and to do so I need to find the ceiling of a number. I know that I can use Math.ceil()
. But the issue is, when I use Math.ceil(,5)
it gives me 1
, and Math.ceil(50/100)
gives me 0
.
Please let me know what is happening to get different ceilings for different values
math.ceil(50/100)
is the same as math.ceil(0)
, since 50/100
is 0
(since integer division is performed here, and the result is therefore an integer).
math.ceil(50.0/100.0)
would give you 1, since 50.0/100.0
will be computed with floating point division and result in 0.5
.