This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Ultrasick
Recipients Ultrasick, Zeev.Rotshtein, mark.dickinson
Date 2012-05-03.11:44:31
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1336045472.89.0.585444637274.issue5118@psf.upfronthosting.co.za>
In-reply-to
Content
Ok, let's sum that up:

There is a rounding problem. That's because Python uses floating point registers of the x86-CPU-architecture to store point values. This method is inaccurate and causes such problems. So Python inherits this bug from this value storing method.

Even thou the origin of this bug is in the method which is beeing used, Python has inherited this bug and can't round correctly.

If we would say that Python does not support point values but only floating point values of the x86-CPU-architecture (so not even floating point values in general) then we could admit that round(2.545, 2) has a bug because it "incorrectly" shows 2.55 as the result. But that wouldn't help us any further.

One possible solution would be to use a different method to store point values. For exaple 2 integers could be used to store a point value lossless. The one integer stores whatever is left of the point and the other integer stores whatever is right of the point. Meaning:

25.0:
-> integer #1: 0,000,000,025
-> integer #2: 0,000,000,000

25.99997:
-> integer #1: 0,000,000,025
-> integer #2: 0,999,970,000

25.00001
-> integer #1: 0,000,000,025
-> integer #2: 0,000,010,000

As you can see, this method is lossless. As long as you don't try to store more than 32 significant bits in a register which is 32 bits in size. To be more accurate: you can't even use all 32 bits because the most significant digit can only be between 0 and 4 (4,294,967,295 barrier).

Using this value storing method would mean quite some efforts for the developers. But then Python would be able to round correctly. So that's why I call it a "possible solution".

I am not the one who is going to make the decision, whether a different value-storing-method is going to be implemented, indepentend how this value storing method may look like. But I am one of thouse who suffered from the method which is currently implemented.

@Mark: And I am also one of thouse who lost a lot of interrest in helping out in the futher development of Python. It was because your haughtiness. You tried to show how perfect Python is and that there would be no bugs. But your last comment was a little more productive. Even thou you still haven't showed much interest in finding a solution to the problem.

@Zeev: I already gave up. But you had more endurance. Thanks :-)

Gary
History
Date User Action Args
2012-05-03 11:44:33Ultrasicksetrecipients: + Ultrasick, mark.dickinson, Zeev.Rotshtein
2012-05-03 11:44:32Ultrasicksetmessageid: <1336045472.89.0.585444637274.issue5118@psf.upfronthosting.co.za>
2012-05-03 11:44:32Ultrasicklinkissue5118 messages
2012-05-03 11:44:31Ultrasickcreate