Best way to calculate fraction part of x?

Emile van Sebille emile at fenx.com
Mon Mar 23 20:38:08 EDT 2015


On 3/23/2015 5:52 AM, Steven D'Aprano wrote:

> Are there any other, possibly better, ways to calculate the fractional part
> of a number?

float (("%6.3f" % x)[-4:])

Emile




More information about the Python-list mailing list