Message67174
On some older Intel 32-bit hardware, under Linux, floating-point
operations don't always give correctly rounded results. Here's an
example involving addition, on SuSE Linux 10.2/Xeon.
Python 2.6a3+ (trunk:63521, May 21 2008, 15:40:39)
[GCC 4.1.2 20061115 (prerelease) (SUSE Linux)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 1e16 + 2.999
10000000000000002.0
>>> 1e16 + 2.9999
10000000000000004.0
The second result should really be 1e16+2., not 1e16+4. This appears to
be related to this GCC issue:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=323
Various fixes are possible. One possible fix is to add the -ffloat-
store flag to the gcc options. Another is to use the information in
fpu_control.h, if available, to set the precision control. Yet another
is to sprinkle some 'volatile' modifiers throughout floatobject.c.
It's not clear to me that this *should* be fixed, but I think the
problem should at least be documented. Hence this bug report. |
|
| Date |
User |
Action |
Args |
| 2008-05-21 20:36:59 | mark.dickinson | set | spambayes_score: 0.00179302 -> 0.00179302 recipients:
+ mark.dickinson |
| 2008-05-21 20:36:57 | mark.dickinson | set | spambayes_score: 0.00179302 -> 0.00179302 messageid: <1211402217.78.0.330998218554.issue2937@psf.upfronthosting.co.za> |
| 2008-05-21 20:36:56 | mark.dickinson | link | issue2937 messages |
| 2008-05-21 20:36:53 | mark.dickinson | create | |
|