Remove integer from float number

Peter Hansen peter at engcorp.com
Fri Mar 24 08:53:52 EST 2006


kpp9c wrote:
> okay... out of curiousity... how would you then seperate the interger
> value from the fractional part do something to one side and then put it
> back together... like if you had 8.01 and you want to add to the '8'
> part in one way (ordinary decimal) and add to the .01 part modulo
> something .. like say modulo 12 so that adding .11 to 8.01 would give
> you 9.0 ...

I believe math.modf() may be what you're looking for.




More information about the Python-list mailing list