how to convert an integer to a float?

yinglcs at gmail.com yinglcs at gmail.com
Tue Feb 27 19:05:40 EST 2007


Hi, I have the following functions,  but ' dx = abs(i2 - i1)/min(i2,
i1)' always return 0, can you please tell me how can i convert it from
an integer to float?


def compareValue(n1, n2):
    i1 = int(n1)
    i2 = int(n2)

    dx = abs(i2 - i1)/min(i2, i1)
    print dx
    return dx < 0.05




More information about the Python-list mailing list