too long float

Steve Holden steve at holdenweb.com
Sat Feb 2 20:15:27 CET 2008


Albert van der Horst wrote:
> In article <slrnfp6ri0.lip.B.Ogryczak at localhost.localdomain>,
> Bart Ogryczak  <z-niusow at bart.w-wa.pl> wrote:
>> On 2008-01-18, citizen J. Peng testified:
>>> hello,
>>>
>>> why this happened on my python?
>>>>>> a=3.9
>>>>>> a
>>> 3.8999999999999999
>>>>> a = 3.9
>>>>> print a
>> 3.9
> 
> This has nothing to do with python.
> 
> Apparently you don't know the first thing about floating point
> numbers. I suggest reading the wikipedia entry.
> http://en.wikipedia/wiki/floating_point
> 
Don't think you are the first person to make this mistake, by the way. 
Despite Albert's tone suggesting that *everybody* knows about floating 
point this is a very common issue among new programmers.

regards
  Steve
-- 
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC              http://www.holdenweb.com/




More information about the Python-list mailing list