getting the fractional part of a real?
gregor.lingl at aon.at
Sat Aug 15 20:55:55 CEST 2009
Christian Heimes schrieb:
> Roy Smith schrieb:
>> What's the best way to get the fractional part of a real? The two
>> ways I can see are r % 1 and r = int(r), but both seem a bit hokey.
>> Is there something more straight-forward that I'm missing, like
>>>> import math
> (0.5, 1.0)
Or without the need to import something:
>>> divmod(1.5, 1)
More information about the Python-list