I have a variable in Python containing a floating point number (e.g. num = 24654.123), and I\'d like to determine the number\'s precision and scale values (in t
num = 24654.123
If you need to check the number of corresponding digits (of a and b)
def prec_check(a, b): a = str(a) b = str(b) do = bool(True) n = 0 while do == True: if a and b and a[n] == a[b]: n += 1 else: do = false return n
Note that this doesn't work with the "Decimal" module.