Getting fractional part from a float without using string operations
Collapse
This topic is closed.
X
X
-
srinivasan srinivasTags: None -
John Machin
Re: Getting fractional part from a float without using stringoperation s
On Nov 20, 12:35 am, srinivasan srinivas <sri_anna...@ya hoo.co.in>
wrote:
<null>
| >>import math
| >>num = 123.4567
| >>math.modf(num )
| (0.456699999999 99789, 123.0)
-
MRAB
Re: Getting fractional part from a float without using stringoperation s
On Nov 19, 1:44 pm, John Machin <sjmac...@lexic on.netwrote:def frac(n):On Nov 20, 12:35 am, srinivasan srinivas <sri_anna...@ya hoo.co.in>
wrote:
<null>
>
| >>import math
| >>num = 123.4567
| >>math.modf(num )
| (0.456699999999 99789, 123.0)
return n - int(n)
Comment
-
Blind Anagram
Re: Getting fractional part from a float without using string operations
"MRAB" <google@mrabarn ett.plus.comwro te in message
news:278930e8-6c65-4059-9dec-713e4ba5b554@w1 g2000prk.google groups.com...
On Nov 19, 1:44 pm, John Machin <sjmac...@lexic on.netwrote:def frac(n):On Nov 20, 12:35 am, srinivasan srinivas <sri_anna...@ya hoo.co.in>
wrote:
<null>
>
| >>import math
| >>num = 123.4567
| >>math.modf(num )
| (0.456699999999 99789, 123.0)
return n - int(n)
n % 1.0
Comment
-
John Machin
Re: Getting fractional part from a float without using stringoperation s
On Nov 20, 3:38 am, "Blind Anagram" <nob...@nowhere .orgwrote:| >>n= -123.4567"MRAB" <goo...@mrabarn ett.plus.comwro te in message
>
news:278930e8-6c65-4059-9dec-713e4ba5b554@w1 g2000prk.google groups.com...
On Nov 19, 1:44 pm, John Machin <sjmac...@lexic on.netwrote:
>>On Nov 20, 12:35 am, srinivasan srinivas <sri_anna...@ya hoo.co.in>
wrote:
<null>>| >>import math
| >>num = 123.4567
| >>math.modf(num )
| (0.456699999999 99789, 123.0)
def frac(n):
return n - int(n)
>
n % 1.0
| >>n % 1.0
| 0.5433000000000 0211
Comment
Comment