summaryrefslogtreecommitdiffstats
path: root/Python/pymath.c
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2009-02-09 17:15:59 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2009-02-09 17:15:59 (GMT)
commit87ec0855c680689898f8f0097efa18c6cb088dfd (patch)
tree8f27f0a2a534f10deb6c20b78344aaf01567c5fb /Python/pymath.c
parentae09899fa39bc0b9a4b79b236aa98bd5f1475134 (diff)
downloadcpython-87ec0855c680689898f8f0097efa18c6cb088dfd.zip
cpython-87ec0855c680689898f8f0097efa18c6cb088dfd.tar.gz
cpython-87ec0855c680689898f8f0097efa18c6cb088dfd.tar.bz2
Merged revisions 69459 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r69459 | mark.dickinson | 2009-02-09 14:18:43 +0000 (Mon, 09 Feb 2009) | 3 lines Issue #4575: fix Py_IS_INFINITY macro to work correctly on x87 FPUs. It now forces its argument to double before testing for infinity. ........
Diffstat (limited to 'Python/pymath.c')
-rw-r--r--Python/pymath.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/Python/pymath.c b/Python/pymath.c
index 5cf61ab..5d09b4c 100644
--- a/Python/pymath.c
+++ b/Python/pymath.c
@@ -1,5 +1,18 @@
#include "Python.h"
+#ifdef X87_DOUBLE_ROUNDING
+/* On x86 platforms using an x87 FPU, this function is called from the
+ Py_FORCE_DOUBLE macro (defined in pymath.h) to force a floating-point
+ number out of an 80-bit x87 FPU register and into a 64-bit memory location,
+ thus rounding from extended precision to double precision. */
+double _Py_force_double(double x)
+{
+ volatile double y;
+ y = x;
+ return y;
+}
+#endif
+
#ifndef HAVE_HYPOT
double hypot(double x, double y)
{