On 2006-02-28, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Quoting Derek Basch <[EMAIL PROTECTED]>: > >> Given a value (x) that is within the range (1e-1, 1e7) how do I round >> (x) up to the closest exact logarithmic decade? For instance: > > How about this: > > def roundup(x): > if x < 1: > return 1 > else: > return '1' + ('0' * len(str(int(x))))
Interesting approach. You're converting to string at the same time. I would guess the OP wanted a float. -- Grant Edwards grante Yow! It's OKAY -- I'm an at INTELLECTUAL, too. visi.com -- http://mail.python.org/mailman/listinfo/python-list