On Thu, Aug 12, 2010 at 1:43 PM, Bradley Hintze <bradle...@aggiemail.usu.edu> wrote: > Hi all. > > Is there a way I can keep my floating point number as I typed it? For > example, I want 34.52 to be 34.52 and NOT 34.5200000002.
<stuff repeating Gary's answer redacted> See also: http://en.wikipedia.org/wiki/Floating_point#Representable_numbers.2C_conversion_and_rounding Another option is to use the `decimal` module, which *can* exactly represent decimal numbers (to a user-specified finite precision) and is generally a bit more intuitive but /substantially/ slower: http://docs.python.org/library/decimal.html Cheers, Chris -- http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list