Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ExeBy/smexe_ro.../usr/include/python3....
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
/* High precision definition of pi and e (Euler)
[39] Fix | Delete
* The values are taken from libc6's math.h.
[40] Fix | Delete
*/
[41] Fix | Delete
#ifndef Py_MATH_PIl
[42] Fix | Delete
#define Py_MATH_PIl 3.1415926535897932384626433832795029L
[43] Fix | Delete
#endif
[44] Fix | Delete
#ifndef Py_MATH_PI
[45] Fix | Delete
#define Py_MATH_PI 3.14159265358979323846
[46] Fix | Delete
#endif
[47] Fix | Delete
[48] Fix | Delete
#ifndef Py_MATH_El
[49] Fix | Delete
#define Py_MATH_El 2.7182818284590452353602874713526625L
[50] Fix | Delete
#endif
[51] Fix | Delete
[52] Fix | Delete
#ifndef Py_MATH_E
[53] Fix | Delete
#define Py_MATH_E 2.7182818284590452354
[54] Fix | Delete
#endif
[55] Fix | Delete
[56] Fix | Delete
/* Tau (2pi) to 40 digits, taken from tauday.com/tau-digits. */
[57] Fix | Delete
#ifndef Py_MATH_TAU
[58] Fix | Delete
#define Py_MATH_TAU 6.2831853071795864769252867665590057683943L
[59] Fix | Delete
#endif
[60] Fix | Delete
[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_LIMITED_API
[69] Fix | Delete
#ifndef Py_FORCE_DOUBLE
[70] Fix | Delete
# ifdef X87_DOUBLE_ROUNDING
[71] Fix | Delete
PyAPI_FUNC(double) _Py_force_double(double);
[72] Fix | Delete
# define Py_FORCE_DOUBLE(X) (_Py_force_double(X))
[73] Fix | Delete
# else
[74] Fix | Delete
# define Py_FORCE_DOUBLE(X) (X)
[75] Fix | Delete
# endif
[76] Fix | Delete
#endif
[77] Fix | Delete
#endif
[78] Fix | Delete
[79] Fix | Delete
#ifndef Py_LIMITED_API
[80] Fix | Delete
#ifdef HAVE_GCC_ASM_FOR_X87
[81] Fix | Delete
PyAPI_FUNC(unsigned short) _Py_get_387controlword(void);
[82] Fix | Delete
PyAPI_FUNC(void) _Py_set_387controlword(unsigned short);
[83] Fix | Delete
#endif
[84] Fix | Delete
#endif
[85] Fix | Delete
[86] Fix | Delete
/* Py_IS_NAN(X)
[87] Fix | Delete
* Return 1 if float or double arg is a NaN, else 0.
[88] Fix | Delete
* Caution:
[89] Fix | Delete
* X is evaluated more than once.
[90] Fix | Delete
* This may not work on all platforms. Each platform has *some*
[91] Fix | Delete
* way to spell this, though -- override in pyconfig.h if you have
[92] Fix | Delete
* a platform where it doesn't work.
[93] Fix | Delete
* Note: PC/pyconfig.h defines Py_IS_NAN as _isnan
[94] Fix | Delete
*/
[95] Fix | Delete
#ifndef Py_IS_NAN
[96] Fix | Delete
#if defined HAVE_DECL_ISNAN && HAVE_DECL_ISNAN == 1
[97] Fix | Delete
#define Py_IS_NAN(X) isnan(X)
[98] Fix | Delete
#else
[99] Fix | Delete
#define Py_IS_NAN(X) ((X) != (X))
[100] Fix | Delete
#endif
[101] Fix | Delete
#endif
[102] Fix | Delete
[103] Fix | Delete
/* Py_IS_INFINITY(X)
[104] Fix | Delete
* Return 1 if float or double arg is an infinity, else 0.
[105] Fix | Delete
* Caution:
[106] Fix | Delete
* X is evaluated more than once.
[107] Fix | Delete
* This implementation may set the underflow flag if |X| is very small;
[108] Fix | Delete
* it really can't be implemented correctly (& easily) before C99.
[109] Fix | Delete
* Override in pyconfig.h if you have a better spelling on your platform.
[110] Fix | Delete
* Py_FORCE_DOUBLE is used to avoid getting false negatives from a
[111] Fix | Delete
* non-infinite value v sitting in an 80-bit x87 register such that
[112] Fix | Delete
* v becomes infinite when spilled from the register to 64-bit memory.
[113] Fix | Delete
* Note: PC/pyconfig.h defines Py_IS_INFINITY as _isinf
[114] Fix | Delete
*/
[115] Fix | Delete
#ifndef Py_IS_INFINITY
[116] Fix | Delete
# if defined HAVE_DECL_ISINF && HAVE_DECL_ISINF == 1
[117] Fix | Delete
# define Py_IS_INFINITY(X) isinf(X)
[118] Fix | Delete
# else
[119] Fix | Delete
# define Py_IS_INFINITY(X) ((X) && \
[120] Fix | Delete
(Py_FORCE_DOUBLE(X)*0.5 == Py_FORCE_DOUBLE(X)))
[121] Fix | Delete
# endif
[122] Fix | Delete
#endif
[123] Fix | Delete
[124] Fix | Delete
/* Py_IS_FINITE(X)
[125] Fix | Delete
* Return 1 if float or double arg is neither infinite nor NAN, else 0.
[126] Fix | Delete
* Some compilers (e.g. VisualStudio) have intrisics for this, so a special
[127] Fix | Delete
* macro for this particular test is useful
[128] Fix | Delete
* Note: PC/pyconfig.h defines Py_IS_FINITE as _finite
[129] Fix | Delete
*/
[130] Fix | Delete
#ifndef Py_IS_FINITE
[131] Fix | Delete
#if defined HAVE_DECL_ISFINITE && HAVE_DECL_ISFINITE == 1
[132] Fix | Delete
#define Py_IS_FINITE(X) isfinite(X)
[133] Fix | Delete
#elif defined HAVE_FINITE
[134] Fix | Delete
#define Py_IS_FINITE(X) finite(X)
[135] Fix | Delete
#else
[136] Fix | Delete
#define Py_IS_FINITE(X) (!Py_IS_INFINITY(X) && !Py_IS_NAN(X))
[137] Fix | Delete
#endif
[138] Fix | Delete
#endif
[139] Fix | Delete
[140] Fix | Delete
/* HUGE_VAL is supposed to expand to a positive double infinity. Python
[141] Fix | Delete
* uses Py_HUGE_VAL instead because some platforms are broken in this
[142] Fix | Delete
* respect. We used to embed code in pyport.h to try to worm around that,
[143] Fix | Delete
* but different platforms are broken in conflicting ways. If you're on
[144] Fix | Delete
* a platform where HUGE_VAL is defined incorrectly, fiddle your Python
[145] Fix | Delete
* config to #define Py_HUGE_VAL to something that works on your platform.
[146] Fix | Delete
*/
[147] Fix | Delete
#ifndef Py_HUGE_VAL
[148] Fix | Delete
#define Py_HUGE_VAL HUGE_VAL
[149] Fix | Delete
#endif
[150] Fix | Delete
[151] Fix | Delete
/* Py_NAN
[152] Fix | Delete
* A value that evaluates to a NaN. On IEEE 754 platforms INF*0 or
[153] Fix | Delete
* INF/INF works. Define Py_NO_NAN in pyconfig.h if your platform
[154] Fix | Delete
* doesn't support NaNs.
[155] Fix | Delete
*/
[156] Fix | Delete
#if !defined(Py_NAN) && !defined(Py_NO_NAN)
[157] Fix | Delete
#if !defined(__INTEL_COMPILER)
[158] Fix | Delete
#define Py_NAN (Py_HUGE_VAL * 0.)
[159] Fix | Delete
#else /* __INTEL_COMPILER */
[160] Fix | Delete
#if defined(ICC_NAN_STRICT)
[161] Fix | Delete
#pragma float_control(push)
[162] Fix | Delete
#pragma float_control(precise, on)
[163] Fix | Delete
#pragma float_control(except, on)
[164] Fix | Delete
#if defined(_MSC_VER)
[165] Fix | Delete
__declspec(noinline)
[166] Fix | Delete
#else /* Linux */
[167] Fix | Delete
__attribute__((noinline))
[168] Fix | Delete
#endif /* _MSC_VER */
[169] Fix | Delete
static double __icc_nan()
[170] Fix | Delete
{
[171] Fix | Delete
return sqrt(-1.0);
[172] Fix | Delete
}
[173] Fix | Delete
#pragma float_control (pop)
[174] Fix | Delete
#define Py_NAN __icc_nan()
[175] Fix | Delete
#else /* ICC_NAN_RELAXED as default for Intel Compiler */
[176] Fix | Delete
static const union { unsigned char buf[8]; double __icc_nan; } __nan_store = {0,0,0,0,0,0,0xf8,0x7f};
[177] Fix | Delete
#define Py_NAN (__nan_store.__icc_nan)
[178] Fix | Delete
#endif /* ICC_NAN_STRICT */
[179] Fix | Delete
#endif /* __INTEL_COMPILER */
[180] Fix | Delete
#endif
[181] Fix | Delete
[182] Fix | Delete
/* Py_OVERFLOWED(X)
[183] Fix | Delete
* Return 1 iff a libm function overflowed. Set errno to 0 before calling
[184] Fix | Delete
* a libm function, and invoke this macro after, passing the function
[185] Fix | Delete
* result.
[186] Fix | Delete
* Caution:
[187] Fix | Delete
* This isn't reliable. C99 no longer requires libm to set errno under
[188] Fix | Delete
* any exceptional condition, but does require +- HUGE_VAL return
[189] Fix | Delete
* values on overflow. A 754 box *probably* maps HUGE_VAL to a
[190] Fix | Delete
* double infinity, and we're cool if that's so, unless the input
[191] Fix | Delete
* was an infinity and an infinity is the expected result. A C89
[192] Fix | Delete
* system sets errno to ERANGE, so we check for that too. We're
[193] Fix | Delete
* out of luck if a C99 754 box doesn't map HUGE_VAL to +Inf, or
[194] Fix | Delete
* if the returned result is a NaN, or if a C89 box returns HUGE_VAL
[195] Fix | Delete
* in non-overflow cases.
[196] Fix | Delete
* X is evaluated more than once.
[197] Fix | Delete
* Some platforms have better way to spell this, so expect some #ifdef'ery.
[198] Fix | Delete
*
[199] Fix | Delete
* OpenBSD uses 'isinf()' because a compiler bug on that platform causes
[200] Fix | Delete
* the longer macro version to be mis-compiled. This isn't optimal, and
[201] Fix | Delete
* should be removed once a newer compiler is available on that platform.
[202] Fix | Delete
* The system that had the failure was running OpenBSD 3.2 on Intel, with
[203] Fix | Delete
* gcc 2.95.3.
[204] Fix | Delete
*
[205] Fix | Delete
* According to Tim's checkin, the FreeBSD systems use isinf() to work
[206] Fix | Delete
* around a FPE bug on that platform.
[207] Fix | Delete
*/
[208] Fix | Delete
#if defined(__FreeBSD__) || defined(__OpenBSD__)
[209] Fix | Delete
#define Py_OVERFLOWED(X) isinf(X)
[210] Fix | Delete
#else
[211] Fix | Delete
#define Py_OVERFLOWED(X) ((X) != 0.0 && (errno == ERANGE || \
[212] Fix | Delete
(X) == Py_HUGE_VAL || \
[213] Fix | Delete
(X) == -Py_HUGE_VAL))
[214] Fix | Delete
#endif
[215] Fix | Delete
[216] Fix | Delete
/* Return whether integral type *type* is signed or not. */
[217] Fix | Delete
#define _Py_IntegralTypeSigned(type) ((type)(-1) < 0)
[218] Fix | Delete
/* Return the maximum value of integral type *type*. */
[219] Fix | Delete
#define _Py_IntegralTypeMax(type) ((_Py_IntegralTypeSigned(type)) ? (((((type)1 << (sizeof(type)*CHAR_BIT - 2)) - 1) << 1) + 1) : ~(type)0)
[220] Fix | Delete
/* Return the minimum value of integral type *type*. */
[221] Fix | Delete
#define _Py_IntegralTypeMin(type) ((_Py_IntegralTypeSigned(type)) ? -_Py_IntegralTypeMax(type) - 1 : 0)
[222] Fix | Delete
/* Check whether *v* is in the range of integral type *type*. This is most
[223] Fix | Delete
* useful if *v* is floating-point, since demoting a floating-point *v* to an
[224] Fix | Delete
* integral type that cannot represent *v*'s integral part is undefined
[225] Fix | Delete
* behavior. */
[226] Fix | Delete
#define _Py_InIntegralTypeRange(type, v) (_Py_IntegralTypeMin(type) <= v && v <= _Py_IntegralTypeMax(type))
[227] Fix | Delete
[228] Fix | Delete
#endif /* Py_PYMATH_H */
[229] Fix | Delete
[230] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function