what is this?

Hari Pulapaka pulapaka at ligo.caltech.edu
Mon Nov 3 17:21:11 EST 2003


Hi,

Most newbies to python, have probably experienced this one time or 
another. And posted it to the newsgroups, where the Python gurus, will 
say, No foo thats how floating points are represented, read the tutorial 
and understand floating point representation, etc...

But call it whatever, 3.4 != 3.3999999999999999 and I feel that 
somewhere some change should be made so that the representation is better.

I saw some discussion earlier where, someone provided a function for 
repr so that the presentation of floating is better and it looked like 
(to me) that it had a solution for this problem.

- Hari

Herbert Fritsch wrote:
> Hi,
> I'm a real beginner with python and I don't really know if I will get it.
> But here is one of my first exercises:
> 
> Python 2.3+ (#1, Sep 23 2003, 23:07:16)
> [GCC 3.3.1 (SuSE Linux)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> 
>>>>a = 3
>>>>b = 4
>>>>b / 2 + a
> 
> 5
> 
>>>>b / (2.0 + a)
> 
> 0.80000000000000004
> 
> There must be something wrong. I' running the new Suse 9.0.
> 
> Herbert





More information about the Python-list mailing list