Getting fractional part from a float without using string operations

Jeremiah Dodds jeremiah.dodds at gmail.com
Wed Nov 19 08:44:17 EST 2008


On Wed, Nov 19, 2008 at 8:35 AM, srinivasan srinivas <
sri_annauni at yahoo.co.in> wrote:

> Thanks,
> Srini
>
>
>      Add more friends to your messenger and enjoy! Go to
> http://messenger.yahoo.com/invite/
> --
> http://mail.python.org/mailman/listinfo/python-list
>

x = 2.99340584
y = abs(int(x) - x)
y
0.99340584

Is that what you wanted?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20081119/8a62ce67/attachment.html>


More information about the Python-list mailing list