Question

Here is the issue:

>>> 16/float(1184000)

returns:

1.3513513513513513e-05

if I try to run math.ceil on this number, i get "1" instead of "2"

>>>math.ceil(16/float(1184000))

returns:

1.0

This seems odd, any ideas how to address this?

Was it helpful?

Solution

Seems like you missed the power : -05:

The number is actually:

>>> '{:.20f}'.format(16/float(1184000))
'0.00001351351351351351'

So the answer is correct.

OTHER TIPS

The number 1 is the smallest integer larger than 16/1184000. That's what math.ceil() does.

1.3513513513513513e-05 is between 0 and 1, so your two answers are consistent.

The number above is read as "1.3513513513513513 times 10 to the negative 5th power."

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top