Yes. But it didn't give only the expected decimals.
For ex:
>>> a = 1.23
>>> abs(int(a) -a)
0.22999999999999998
I would like to get the result '0.23' only.
Thanks,
Srini
________________________________
From: Jeremiah Dodds <[EMAIL PROTECTED]>
To: python-list@python.org
Sent: Wednesday, 19 November, 2008 7:14:17 PM
Subject: Re: Getting fractional part from a float without using string
operations
On Wed, Nov 19, 2008 at 8:35 AM, srinivasan srinivas <[EMAIL PROTECTED]> 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?
Get perfect Email ID for your Resume. Grab now
http://in.promos.yahoo.com/address
--
http://mail.python.org/mailman/listinfo/python-list