Floating numbers

Grant Edwards invalid at invalid.invalid
Thu Aug 12 23:20:18 CEST 2010

On 2010-08-12, Bradley Hintze <bradley.h at aggiemail.usu.edu> wrote:

> 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.

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:


Can you explain what your actual problem is?
Grant Edwards               grant.b.edwards        Yow! I'm imagining a surfer
                                  at               van filled with soy sauce!

More information about the Python-list mailing list