Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ExeBy/smexe_ro.../usr/include/python2....
File: pymath.h
#ifndef Py_PYMATH_H
[0] Fix | Delete
#define Py_PYMATH_H
[1] Fix | Delete
[2] Fix | Delete
#include "pyconfig.h" /* include for defines */
[3] Fix | Delete
[4] Fix | Delete
/**************************************************************************
[5] Fix | Delete
Symbols and macros to supply platform-independent interfaces to mathematical
[6] Fix | Delete
functions and constants
[7] Fix | Delete
**************************************************************************/
[8] Fix | Delete
[9] Fix | Delete
/* Python provides implementations for copysign, round and hypot in
[10] Fix | Delete
* Python/pymath.c just in case your math library doesn't provide the
[11] Fix | Delete
* functions.
[12] Fix | Delete
*
[13] Fix | Delete
*Note: PC/pyconfig.h defines copysign as _copysign
[14] Fix | Delete
*/
[15] Fix | Delete
#ifndef HAVE_COPYSIGN
[16] Fix | Delete
extern double copysign(double, double);
[17] Fix | Delete
#endif
[18] Fix | Delete
[19] Fix | Delete
#ifndef HAVE_ROUND
[20] Fix | Delete
extern double round(double);
[21] Fix | Delete
#endif
[22] Fix | Delete
[23] Fix | Delete
#ifndef HAVE_HYPOT
[24] Fix | Delete
extern double hypot(double, double);
[25] Fix | Delete
#endif
[26] Fix | Delete
[27] Fix | Delete
/* extra declarations */
[28] Fix | Delete
#ifndef _MSC_VER
[29] Fix | Delete
#ifndef __STDC__
[30] Fix | Delete
extern double fmod (double, double);
[31] Fix | Delete
extern double frexp (double, int *);
[32] Fix | Delete
extern double ldexp (double, int);
[33] Fix | Delete
extern double modf (double, double *);
[34] Fix | Delete
extern double pow(double, double);
[35] Fix | Delete
#endif /* __STDC__ */
[36] Fix | Delete
#endif /* _MSC_VER */
[37] Fix | Delete
[38] Fix | Delete
#ifdef _OSF_SOURCE
[39] Fix | Delete
/* OSF1 5.1 doesn't make these available with XOPEN_SOURCE_EXTENDED defined */
[40] Fix | Delete
extern int finite(double);
[41] Fix | Delete
extern double copysign(double, double);
[42] Fix | Delete
#endif
[43] Fix | Delete
[44] Fix | Delete
/* High precision definition of pi and e (Euler)
[45] Fix | Delete
* The values are taken from libc6's math.h.
[46] Fix | Delete
*/
[47] Fix | Delete
#ifndef Py_MATH_PIl
[48] Fix | Delete
#define Py_MATH_PIl 3.1415926535897932384626433832795029L
[49] Fix | Delete
#endif
[50] Fix | Delete
#ifndef Py_MATH_PI
[51] Fix | Delete
#define Py_MATH_PI 3.14159265358979323846
[52] Fix | Delete
#endif
[53] Fix | Delete
[54] Fix | Delete
#ifndef Py_MATH_El
[55] Fix | Delete
#define Py_MATH_El 2.7182818284590452353602874713526625L
[56] Fix | Delete
#endif
[57] Fix | Delete
[58] Fix | Delete
#ifndef Py_MATH_E
[59] Fix | Delete
#define Py_MATH_E 2.7182818284590452354
[60] Fix | Delete
#endif
[61] Fix | Delete
[62] Fix | Delete
/* On x86, Py_FORCE_DOUBLE forces a floating-point number out of an x87 FPU
[63] Fix | Delete
register and into a 64-bit memory location, rounding from extended
[64] Fix | Delete
precision to double precision in the process. On other platforms it does
[65] Fix | Delete
nothing. */
[66] Fix | Delete
[67] Fix | Delete
/* we take double rounding as evidence of x87 usage */
[68] Fix | Delete
#ifndef Py_FORCE_DOUBLE
[69] Fix | Delete
# ifdef X87_DOUBLE_ROUNDING
[70] Fix | Delete
PyAPI_FUNC(double) _Py_force_double(double);
[71] Fix | Delete
# define Py_FORCE_DOUBLE(X) (_Py_force_double(X))
[72] Fix | Delete
# else
[73] Fix | Delete
# define Py_FORCE_DOUBLE(X) (X)
[74] Fix | Delete
# endif
[75] Fix | Delete
#endif
[76] Fix | Delete
[77] Fix | Delete
#ifdef HAVE_GCC_ASM_FOR_X87
[78] Fix | Delete
PyAPI_FUNC(unsigned short) _Py_get_387controlword(void);
[79] Fix | Delete
PyAPI_FUNC(void) _Py_set_387controlword(unsigned short);
[80] Fix | Delete
#endif
[81] Fix | Delete
[82] Fix | Delete
/* Py_IS_NAN(X)
[83] Fix | Delete
* Return 1 if float or double arg is a NaN, else 0.
[84] Fix | Delete
* Caution:
[85] Fix | Delete
* X is evaluated more than once.
[86] Fix | Delete
* This may not work on all platforms. Each platform has *some*
[87] Fix | Delete
* way to spell this, though -- override in pyconfig.h if you have
[88] Fix | Delete
* a platform where it doesn't work.
[89] Fix | Delete
* Note: PC/pyconfig.h defines Py_IS_NAN as _isnan
[90] Fix | Delete
*/
[91] Fix | Delete
#ifndef Py_IS_NAN
[92] Fix | Delete
#if defined HAVE_DECL_ISNAN && HAVE_DECL_ISNAN == 1
[93] Fix | Delete
#define Py_IS_NAN(X) isnan(X)
[94] Fix | Delete
#else
[95] Fix | Delete
#define Py_IS_NAN(X) ((X) != (X))
[96] Fix | Delete
#endif
[97] Fix | Delete
#endif
[98] Fix | Delete
[99] Fix | Delete
/* Py_IS_INFINITY(X)
[100] Fix | Delete
* Return 1 if float or double arg is an infinity, else 0.
[101] Fix | Delete
* Caution:
[102] Fix | Delete
* X is evaluated more than once.
[103] Fix | Delete
* This implementation may set the underflow flag if |X| is very small;
[104] Fix | Delete
* it really can't be implemented correctly (& easily) before C99.
[105] Fix | Delete
* Override in pyconfig.h if you have a better spelling on your platform.
[106] Fix | Delete
* Py_FORCE_DOUBLE is used to avoid getting false negatives from a
[107] Fix | Delete
* non-infinite value v sitting in an 80-bit x87 register such that
[108] Fix | Delete
* v becomes infinite when spilled from the register to 64-bit memory.
[109] Fix | Delete
* Note: PC/pyconfig.h defines Py_IS_INFINITY as _isinf
[110] Fix | Delete
*/
[111] Fix | Delete
#ifndef Py_IS_INFINITY
[112] Fix | Delete
# if defined HAVE_DECL_ISINF && HAVE_DECL_ISINF == 1
[113] Fix | Delete
# define Py_IS_INFINITY(X) isinf(X)
[114] Fix | Delete
# else
[115] Fix | Delete
# define Py_IS_INFINITY(X) ((X) && \
[116] Fix | Delete
(Py_FORCE_DOUBLE(X)*0.5 == Py_FORCE_DOUBLE(X)))
[117] Fix | Delete
# endif
[118] Fix | Delete
#endif
[119] Fix | Delete
[120] Fix | Delete
/* Py_IS_FINITE(X)
[121] Fix | Delete
* Return 1 if float or double arg is neither infinite nor NAN, else 0.
[122] Fix | Delete
* Some compilers (e.g. VisualStudio) have intrisics for this, so a special
[123] Fix | Delete
* macro for this particular test is useful
[124] Fix | Delete
* Note: PC/pyconfig.h defines Py_IS_FINITE as _finite
[125] Fix | Delete
*/
[126] Fix | Delete
#ifndef Py_IS_FINITE
[127] Fix | Delete
#if defined HAVE_DECL_ISFINITE && HAVE_DECL_ISFINITE == 1
[128] Fix | Delete
#define Py_IS_FINITE(X) isfinite(X)
[129] Fix | Delete
#elif defined HAVE_FINITE
[130] Fix | Delete
#define Py_IS_FINITE(X) finite(X)
[131] Fix | Delete
#else
[132] Fix | Delete
#define Py_IS_FINITE(X) (!Py_IS_INFINITY(X) && !Py_IS_NAN(X))
[133] Fix | Delete
#endif
[134] Fix | Delete
#endif
[135] Fix | Delete
[136] Fix | Delete
/* HUGE_VAL is supposed to expand to a positive double infinity. Python
[137] Fix | Delete
* uses Py_HUGE_VAL instead because some platforms are broken in this
[138] Fix | Delete
* respect. We used to embed code in pyport.h to try to worm around that,
[139] Fix | Delete
* but different platforms are broken in conflicting ways. If you're on
[140] Fix | Delete
* a platform where HUGE_VAL is defined incorrectly, fiddle your Python
[141] Fix | Delete
* config to #define Py_HUGE_VAL to something that works on your platform.
[142] Fix | Delete
*/
[143] Fix | Delete
#ifndef Py_HUGE_VAL
[144] Fix | Delete
#define Py_HUGE_VAL HUGE_VAL
[145] Fix | Delete
#endif
[146] Fix | Delete
[147] Fix | Delete
/* Py_NAN
[148] Fix | Delete
* A value that evaluates to a NaN. On IEEE 754 platforms INF*0 or
[149] Fix | Delete
* INF/INF works. Define Py_NO_NAN in pyconfig.h if your platform
[150] Fix | Delete
* doesn't support NaNs.
[151] Fix | Delete
*/
[152] Fix | Delete
#if !defined(Py_NAN) && !defined(Py_NO_NAN)
[153] Fix | Delete
#if !defined(__INTEL_COMPILER)
[154] Fix | Delete
#define Py_NAN (Py_HUGE_VAL * 0.)
[155] Fix | Delete
#else /* __INTEL_COMPILER */
[156] Fix | Delete
#if defined(ICC_NAN_STRICT)
[157] Fix | Delete
#pragma float_control(push)
[158] Fix | Delete
#pragma float_control(precise, on)
[159] Fix | Delete
#pragma float_control(except, on)
[160] Fix | Delete
#if defined(_MSC_VER)
[161] Fix | Delete
__declspec(noinline)
[162] Fix | Delete
#else /* Linux */
[163] Fix | Delete
__attribute__((noinline))
[164] Fix | Delete
#endif /* _MSC_VER */
[165] Fix | Delete
static double __icc_nan()
[166] Fix | Delete
{
[167] Fix | Delete
return sqrt(-1.0);
[168] Fix | Delete
}
[169] Fix | Delete
#pragma float_control (pop)
[170] Fix | Delete
#define Py_NAN __icc_nan()
[171] Fix | Delete
#else /* ICC_NAN_RELAXED as default for Intel Compiler */
[172] Fix | Delete
static union { unsigned char buf[8]; double __icc_nan; } __nan_store = {0,0,0,0,0,0,0xf8,0x7f};
[173] Fix | Delete
#define Py_NAN (__nan_store.__icc_nan)
[174] Fix | Delete
#endif /* ICC_NAN_STRICT */
[175] Fix | Delete
#endif /* __INTEL_COMPILER */
[176] Fix | Delete
#endif
[177] Fix | Delete
[178] Fix | Delete
/* Py_OVERFLOWED(X)
[179] Fix | Delete
* Return 1 iff a libm function overflowed. Set errno to 0 before calling
[180] Fix | Delete
* a libm function, and invoke this macro after, passing the function
[181] Fix | Delete
* result.
[182] Fix | Delete
* Caution:
[183] Fix | Delete
* This isn't reliable. C99 no longer requires libm to set errno under
[184] Fix | Delete
* any exceptional condition, but does require +- HUGE_VAL return
[185] Fix | Delete
* values on overflow. A 754 box *probably* maps HUGE_VAL to a
[186] Fix | Delete
* double infinity, and we're cool if that's so, unless the input
[187] Fix | Delete
* was an infinity and an infinity is the expected result. A C89
[188] Fix | Delete
* system sets errno to ERANGE, so we check for that too. We're
[189] Fix | Delete
* out of luck if a C99 754 box doesn't map HUGE_VAL to +Inf, or
[190] Fix | Delete
* if the returned result is a NaN, or if a C89 box returns HUGE_VAL
[191] Fix | Delete
* in non-overflow cases.
[192] Fix | Delete
* X is evaluated more than once.
[193] Fix | Delete
* Some platforms have better way to spell this, so expect some #ifdef'ery.
[194] Fix | Delete
*
[195] Fix | Delete
* OpenBSD uses 'isinf()' because a compiler bug on that platform causes
[196] Fix | Delete
* the longer macro version to be mis-compiled. This isn't optimal, and
[197] Fix | Delete
* should be removed once a newer compiler is available on that platform.
[198] Fix | Delete
* The system that had the failure was running OpenBSD 3.2 on Intel, with
[199] Fix | Delete
* gcc 2.95.3.
[200] Fix | Delete
*
[201] Fix | Delete
* According to Tim's checkin, the FreeBSD systems use isinf() to work
[202] Fix | Delete
* around a FPE bug on that platform.
[203] Fix | Delete
*/
[204] Fix | Delete
#if defined(__FreeBSD__) || defined(__OpenBSD__)
[205] Fix | Delete
#define Py_OVERFLOWED(X) isinf(X)
[206] Fix | Delete
#else
[207] Fix | Delete
#define Py_OVERFLOWED(X) ((X) != 0.0 && (errno == ERANGE || \
[208] Fix | Delete
(X) == Py_HUGE_VAL || \
[209] Fix | Delete
(X) == -Py_HUGE_VAL))
[210] Fix | Delete
#endif
[211] Fix | Delete
[212] Fix | Delete
#endif /* Py_PYMATH_H */
[213] Fix | Delete
[214] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function