On 2010-08-12, Grant Edwards <inva...@invalid.invalid> wrote: > On 2010-08-12, Bradley Hintze <bradle...@aggiemail.usu.edu> wrote: > >> Is there a way I can keep my floating point number as I typed it? > > No. > >> For example, I want 34.52 to be 34.52 and NOT 34.5200000002. > > You can't represent 34.52 using base-2 IEEE floating point (the HW > floating point format used by pretty much all modern computers). > 34.5200000002 is as close as you can get. > > When you enter a base-10 floating-point number, the computer will use > the closest base-2 IEEE floating point number. > > Here are the nitty-gritty details: > > http://docs.sun.com/source/806-3568/ncg_goldberg.html
Here is a gentler intro: http://pyfaq.infogami.com/why-are-floating-point-calculations-so-inaccurate -- Grant Edwards grant.b.edwards Yow! If I felt any more at SOPHISTICATED I would DIE gmail.com of EMBARRASSMENT! -- http://mail.python.org/mailman/listinfo/python-list