+++ /dev/null
-#include "Python.h"\r
-\r
-#ifdef X87_DOUBLE_ROUNDING\r
-/* On x86 platforms using an x87 FPU, this function is called from the\r
- Py_FORCE_DOUBLE macro (defined in pymath.h) to force a floating-point\r
- number out of an 80-bit x87 FPU register and into a 64-bit memory location,\r
- thus rounding from extended precision to double precision. */\r
-double _Py_force_double(double x)\r
-{\r
- volatile double y;\r
- y = x;\r
- return y;\r
-}\r
-#endif\r
-\r
-#ifdef HAVE_GCC_ASM_FOR_X87\r
-\r
-/* inline assembly for getting and setting the 387 FPU control word on\r
- gcc/x86 */\r
-\r
-unsigned short _Py_get_387controlword(void) {\r
- unsigned short cw;\r
- __asm__ __volatile__ ("fnstcw %0" : "=m" (cw));\r
- return cw;\r
-}\r
-\r
-void _Py_set_387controlword(unsigned short cw) {\r
- __asm__ __volatile__ ("fldcw %0" : : "m" (cw));\r
-}\r
-\r
-#endif\r
-\r
-\r
-#ifndef HAVE_HYPOT\r
-double hypot(double x, double y)\r
-{\r
- double yx;\r
-\r
- x = fabs(x);\r
- y = fabs(y);\r
- if (x < y) {\r
- double temp = x;\r
- x = y;\r
- y = temp;\r
- }\r
- if (x == 0.)\r
- return 0.;\r
- else {\r
- yx = y/x;\r
- return x*sqrt(1.+yx*yx);\r
- }\r
-}\r
-#endif /* HAVE_HYPOT */\r
-\r
-#ifndef HAVE_COPYSIGN\r
-double\r
-copysign(double x, double y)\r
-{\r
- /* use atan2 to distinguish -0. from 0. */\r
- if (y > 0. || (y == 0. && atan2(y, -1.) > 0.)) {\r
- return fabs(x);\r
- } else {\r
- return -fabs(x);\r
- }\r
-}\r
-#endif /* HAVE_COPYSIGN */\r
-\r
-#ifndef HAVE_ROUND\r
-double\r
-round(double x)\r
-{\r
- double absx, y;\r
- absx = fabs(x);\r
- y = floor(absx);\r
- if (absx - y >= 0.5)\r
- y += 1.0;\r
- return copysign(y, x);\r
-}\r
-#endif /* HAVE_ROUND */\r