weird multiplication behaviour in Python 2.5 under Kubuntu 8.10

Bug #305849 reported by gedece

This bug report was converted into a question: question #53709: weird multiplication behaviour in Python 2.5 under Kubuntu 8.10.

2
Affects Status Importance Assigned to Milestone
python-defaults (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

My system:
 lsb_release -rd
Description: Ubuntu 8.10
Release: 8.10

apt-cache policy python
python:
  Instalados: 2.5.2-1ubuntu1
  Candidato: 2.5.2-1ubuntu1
  Tabla de versión:
 *** 2.5.2-1ubuntu1 0
        500 http://archive.ubuntu.com intrepid/main Packages
        100 /var/lib/dpkg/status

Under Kubuntu 8.10 updated from 8.04 I was trying a program in Python 2.5.2. I have this Python because adept doesn't show 2.6 or 3.0.

this program made a calculation and didn't meet the condition, so I begun testing it in the python command line. To my surprise I got this nice repeatable error.

Python 2.5.2 (r252:60911, Oct 5 2008, 19:24:49)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 2.15*7
15.049999999999999
>>>

clearly this should have read 15.05

Revision history for this message
Florian Diesch (diesch) wrote :

Thank you for taking the time to report this issue and helping to make Ubuntu better.

The reported behavior is a common problem when using floating point values: Due to the limited precision some values can't be expressed precisely, similar to e.g. 1/3 can't be expressed as a decimal value.

As this issue isn't really a bug I'm going to convert it to a question. Feel free to ask further questions if something about it isn't clear.

Changed in python-defaults:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related questions

Remote bug watches

Bug watches keep track of this bug in other bug trackers.