New submission from Mark Dickinson <[EMAIL PROTECTED]>: 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. ---------- components: Interpreter Core messages: 67174 nosy: marketdickinson priority: normal severity: normal status: open title: Incorrect rounding in floating-point operations with gcc/x87 type: behavior versions: Python 2.6, Python 3.0 __________________________________ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2937> __________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com