float precision and caching

Alex Martelli aleax at aleax.it
Mon Feb 3 17:16:17 EST 2003


Eric Mattes wrote:

> Hi all. Can anyone suggest the most processor-efficient way to trim the
> precision of a floating-point value?

x = round(x, 2)

to round to "2 digits" worth of precision, for example.


Alex





More information about the Python-list mailing list