All pastes #356996 Raw Edit

nlindblad

public python v1 · immutable
·published 2007-02-15 11:48 UTC
rendered paste body
from math import floor, log10, sqrtdef frac(x):        f = []        l = sqrt((floor(log10(x)))**2)        d = 10**l        n = x *d        a = d        b = n        while b != 0:                t = b                b = a % b                a = t        d = d/t        n = n/t        f.append(n)        f.append(d)        return f