Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ShExBy/shex_roo.../usr/include/bits
File: mathinline.h
/* Inline math functions for i387 and SSE.
[0] Fix | Delete
Copyright (C) 1995-2018 Free Software Foundation, Inc.
[1] Fix | Delete
This file is part of the GNU C Library.
[2] Fix | Delete
[3] Fix | Delete
The GNU C Library is free software; you can redistribute it and/or
[4] Fix | Delete
modify it under the terms of the GNU Lesser General Public
[5] Fix | Delete
License as published by the Free Software Foundation; either
[6] Fix | Delete
version 2.1 of the License, or (at your option) any later version.
[7] Fix | Delete
[8] Fix | Delete
The GNU C Library is distributed in the hope that it will be useful,
[9] Fix | Delete
but WITHOUT ANY WARRANTY; without even the implied warranty of
[10] Fix | Delete
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
[11] Fix | Delete
Lesser General Public License for more details.
[12] Fix | Delete
[13] Fix | Delete
You should have received a copy of the GNU Lesser General Public
[14] Fix | Delete
License along with the GNU C Library; if not, see
[15] Fix | Delete
<http://www.gnu.org/licenses/>. */
[16] Fix | Delete
[17] Fix | Delete
#ifndef _MATH_H
[18] Fix | Delete
# error "Never use <bits/mathinline.h> directly; include <math.h> instead."
[19] Fix | Delete
#endif
[20] Fix | Delete
[21] Fix | Delete
#ifndef __extern_always_inline
[22] Fix | Delete
# define __MATH_INLINE __inline
[23] Fix | Delete
#else
[24] Fix | Delete
# define __MATH_INLINE __extern_always_inline
[25] Fix | Delete
#endif
[26] Fix | Delete
[27] Fix | Delete
/* Disable x87 inlines when -fpmath=sse is passed and also when we're building
[28] Fix | Delete
on x86_64. Older gcc (gcc-3.2 for example) does not define __SSE2_MATH__
[29] Fix | Delete
for x86_64. */
[30] Fix | Delete
#if !defined __SSE2_MATH__ && !defined __x86_64__
[31] Fix | Delete
# if ((!defined __NO_MATH_INLINES || defined __LIBC_INTERNAL_MATH_INLINES) \
[32] Fix | Delete
&& defined __OPTIMIZE__)
[33] Fix | Delete
[34] Fix | Delete
/* The inline functions do not set errno or raise necessarily the
[35] Fix | Delete
correct exceptions. */
[36] Fix | Delete
# undef math_errhandling
[37] Fix | Delete
[38] Fix | Delete
/* A macro to define float, double, and long double versions of various
[39] Fix | Delete
math functions for the ix87 FPU. FUNC is the function name (which will
[40] Fix | Delete
be suffixed with f and l for the float and long double version,
[41] Fix | Delete
respectively). OP is the name of the FPU operation.
[42] Fix | Delete
We define two sets of macros. The set with the additional NP
[43] Fix | Delete
doesn't add a prototype declaration. */
[44] Fix | Delete
[45] Fix | Delete
# ifdef __USE_ISOC99
[46] Fix | Delete
# define __inline_mathop(func, op) \
[47] Fix | Delete
__inline_mathop_ (double, func, op) \
[48] Fix | Delete
__inline_mathop_ (float, __CONCAT(func,f), op) \
[49] Fix | Delete
__inline_mathop_ (long double, __CONCAT(func,l), op)
[50] Fix | Delete
# define __inline_mathopNP(func, op) \
[51] Fix | Delete
__inline_mathopNP_ (double, func, op) \
[52] Fix | Delete
__inline_mathopNP_ (float, __CONCAT(func,f), op) \
[53] Fix | Delete
__inline_mathopNP_ (long double, __CONCAT(func,l), op)
[54] Fix | Delete
# else
[55] Fix | Delete
# define __inline_mathop(func, op) \
[56] Fix | Delete
__inline_mathop_ (double, func, op)
[57] Fix | Delete
# define __inline_mathopNP(func, op) \
[58] Fix | Delete
__inline_mathopNP_ (double, func, op)
[59] Fix | Delete
# endif
[60] Fix | Delete
[61] Fix | Delete
# define __inline_mathop_(float_type, func, op) \
[62] Fix | Delete
__inline_mathop_decl_ (float_type, func, op, "0" (__x))
[63] Fix | Delete
# define __inline_mathopNP_(float_type, func, op) \
[64] Fix | Delete
__inline_mathop_declNP_ (float_type, func, op, "0" (__x))
[65] Fix | Delete
[66] Fix | Delete
[67] Fix | Delete
# ifdef __USE_ISOC99
[68] Fix | Delete
# define __inline_mathop_decl(func, op, params...) \
[69] Fix | Delete
__inline_mathop_decl_ (double, func, op, params) \
[70] Fix | Delete
__inline_mathop_decl_ (float, __CONCAT(func,f), op, params) \
[71] Fix | Delete
__inline_mathop_decl_ (long double, __CONCAT(func,l), op, params)
[72] Fix | Delete
# define __inline_mathop_declNP(func, op, params...) \
[73] Fix | Delete
__inline_mathop_declNP_ (double, func, op, params) \
[74] Fix | Delete
__inline_mathop_declNP_ (float, __CONCAT(func,f), op, params) \
[75] Fix | Delete
__inline_mathop_declNP_ (long double, __CONCAT(func,l), op, params)
[76] Fix | Delete
# else
[77] Fix | Delete
# define __inline_mathop_decl(func, op, params...) \
[78] Fix | Delete
__inline_mathop_decl_ (double, func, op, params)
[79] Fix | Delete
# define __inline_mathop_declNP(func, op, params...) \
[80] Fix | Delete
__inline_mathop_declNP_ (double, func, op, params)
[81] Fix | Delete
# endif
[82] Fix | Delete
[83] Fix | Delete
# define __inline_mathop_decl_(float_type, func, op, params...) \
[84] Fix | Delete
__MATH_INLINE float_type func (float_type) __THROW; \
[85] Fix | Delete
__inline_mathop_declNP_ (float_type, func, op, params)
[86] Fix | Delete
[87] Fix | Delete
# define __inline_mathop_declNP_(float_type, func, op, params...) \
[88] Fix | Delete
__MATH_INLINE float_type __NTH (func (float_type __x)) \
[89] Fix | Delete
{ \
[90] Fix | Delete
register float_type __result; \
[91] Fix | Delete
__asm __volatile__ (op : "=t" (__result) : params); \
[92] Fix | Delete
return __result; \
[93] Fix | Delete
}
[94] Fix | Delete
[95] Fix | Delete
[96] Fix | Delete
# ifdef __USE_ISOC99
[97] Fix | Delete
# define __inline_mathcode(func, arg, code) \
[98] Fix | Delete
__inline_mathcode_ (double, func, arg, code) \
[99] Fix | Delete
__inline_mathcode_ (float, __CONCAT(func,f), arg, code) \
[100] Fix | Delete
__inline_mathcode_ (long double, __CONCAT(func,l), arg, code)
[101] Fix | Delete
# define __inline_mathcodeNP(func, arg, code) \
[102] Fix | Delete
__inline_mathcodeNP_ (double, func, arg, code) \
[103] Fix | Delete
__inline_mathcodeNP_ (float, __CONCAT(func,f), arg, code) \
[104] Fix | Delete
__inline_mathcodeNP_ (long double, __CONCAT(func,l), arg, code)
[105] Fix | Delete
# define __inline_mathcode2(func, arg1, arg2, code) \
[106] Fix | Delete
__inline_mathcode2_ (double, func, arg1, arg2, code) \
[107] Fix | Delete
__inline_mathcode2_ (float, __CONCAT(func,f), arg1, arg2, code) \
[108] Fix | Delete
__inline_mathcode2_ (long double, __CONCAT(func,l), arg1, arg2, code)
[109] Fix | Delete
# define __inline_mathcodeNP2(func, arg1, arg2, code) \
[110] Fix | Delete
__inline_mathcodeNP2_ (double, func, arg1, arg2, code) \
[111] Fix | Delete
__inline_mathcodeNP2_ (float, __CONCAT(func,f), arg1, arg2, code) \
[112] Fix | Delete
__inline_mathcodeNP2_ (long double, __CONCAT(func,l), arg1, arg2, code)
[113] Fix | Delete
# define __inline_mathcode3(func, arg1, arg2, arg3, code) \
[114] Fix | Delete
__inline_mathcode3_ (double, func, arg1, arg2, arg3, code) \
[115] Fix | Delete
__inline_mathcode3_ (float, __CONCAT(func,f), arg1, arg2, arg3, code) \
[116] Fix | Delete
__inline_mathcode3_ (long double, __CONCAT(func,l), arg1, arg2, arg3, code)
[117] Fix | Delete
# define __inline_mathcodeNP3(func, arg1, arg2, arg3, code) \
[118] Fix | Delete
__inline_mathcodeNP3_ (double, func, arg1, arg2, arg3, code) \
[119] Fix | Delete
__inline_mathcodeNP3_ (float, __CONCAT(func,f), arg1, arg2, arg3, code) \
[120] Fix | Delete
__inline_mathcodeNP3_ (long double, __CONCAT(func,l), arg1, arg2, arg3, code)
[121] Fix | Delete
# else
[122] Fix | Delete
# define __inline_mathcode(func, arg, code) \
[123] Fix | Delete
__inline_mathcode_ (double, func, (arg), code)
[124] Fix | Delete
# define __inline_mathcodeNP(func, arg, code) \
[125] Fix | Delete
__inline_mathcodeNP_ (double, func, (arg), code)
[126] Fix | Delete
# define __inline_mathcode2(func, arg1, arg2, code) \
[127] Fix | Delete
__inline_mathcode2_ (double, func, arg1, arg2, code)
[128] Fix | Delete
# define __inline_mathcodeNP2(func, arg1, arg2, code) \
[129] Fix | Delete
__inline_mathcodeNP2_ (double, func, arg1, arg2, code)
[130] Fix | Delete
# define __inline_mathcode3(func, arg1, arg2, arg3, code) \
[131] Fix | Delete
__inline_mathcode3_ (double, func, arg1, arg2, arg3, code)
[132] Fix | Delete
# define __inline_mathcodeNP3(func, arg1, arg2, arg3, code) \
[133] Fix | Delete
__inline_mathcodeNP3_ (double, func, arg1, arg2, arg3, code)
[134] Fix | Delete
# endif
[135] Fix | Delete
[136] Fix | Delete
# define __inline_mathcode_(float_type, func, arg, code) \
[137] Fix | Delete
__MATH_INLINE float_type func (float_type) __THROW; \
[138] Fix | Delete
__inline_mathcodeNP_(float_type, func, arg, code)
[139] Fix | Delete
[140] Fix | Delete
# define __inline_mathcodeNP_(float_type, func, arg, code) \
[141] Fix | Delete
__MATH_INLINE float_type __NTH (func (float_type arg)) \
[142] Fix | Delete
{ \
[143] Fix | Delete
code; \
[144] Fix | Delete
}
[145] Fix | Delete
[146] Fix | Delete
[147] Fix | Delete
# define __inline_mathcode2_(float_type, func, arg1, arg2, code) \
[148] Fix | Delete
__MATH_INLINE float_type func (float_type, float_type) __THROW; \
[149] Fix | Delete
__inline_mathcodeNP2_ (float_type, func, arg1, arg2, code)
[150] Fix | Delete
[151] Fix | Delete
# define __inline_mathcodeNP2_(float_type, func, arg1, arg2, code) \
[152] Fix | Delete
__MATH_INLINE float_type __NTH (func (float_type arg1, float_type arg2)) \
[153] Fix | Delete
{ \
[154] Fix | Delete
code; \
[155] Fix | Delete
}
[156] Fix | Delete
[157] Fix | Delete
# define __inline_mathcode3_(float_type, func, arg1, arg2, arg3, code) \
[158] Fix | Delete
__MATH_INLINE float_type func (float_type, float_type, float_type) __THROW; \
[159] Fix | Delete
__inline_mathcodeNP3_(float_type, func, arg1, arg2, arg3, code)
[160] Fix | Delete
[161] Fix | Delete
# define __inline_mathcodeNP3_(float_type, func, arg1, arg2, arg3, code) \
[162] Fix | Delete
__MATH_INLINE float_type __NTH (func (float_type arg1, float_type arg2, \
[163] Fix | Delete
float_type arg3)) \
[164] Fix | Delete
{ \
[165] Fix | Delete
code; \
[166] Fix | Delete
}
[167] Fix | Delete
# endif
[168] Fix | Delete
[169] Fix | Delete
[170] Fix | Delete
# if !defined __NO_MATH_INLINES && defined __OPTIMIZE__
[171] Fix | Delete
/* Miscellaneous functions */
[172] Fix | Delete
[173] Fix | Delete
/* __FAST_MATH__ is defined by gcc -ffast-math. */
[174] Fix | Delete
# ifdef __FAST_MATH__
[175] Fix | Delete
/* Optimized inline implementation, sometimes with reduced precision
[176] Fix | Delete
and/or argument range. */
[177] Fix | Delete
[178] Fix | Delete
# if __GNUC_PREREQ (3, 5)
[179] Fix | Delete
# define __expm1_code \
[180] Fix | Delete
register long double __temp; \
[181] Fix | Delete
__temp = __builtin_expm1l (__x); \
[182] Fix | Delete
return __temp ? __temp : __x
[183] Fix | Delete
# else
[184] Fix | Delete
# define __expm1_code \
[185] Fix | Delete
register long double __value; \
[186] Fix | Delete
register long double __exponent; \
[187] Fix | Delete
register long double __temp; \
[188] Fix | Delete
__asm __volatile__ \
[189] Fix | Delete
("fldl2e # e^x - 1 = 2^(x * log2(e)) - 1\n\t" \
[190] Fix | Delete
"fmul %%st(1) # x * log2(e)\n\t" \
[191] Fix | Delete
"fst %%st(1)\n\t" \
[192] Fix | Delete
"frndint # int(x * log2(e))\n\t" \
[193] Fix | Delete
"fxch\n\t" \
[194] Fix | Delete
"fsub %%st(1) # fract(x * log2(e))\n\t" \
[195] Fix | Delete
"f2xm1 # 2^(fract(x * log2(e))) - 1\n\t" \
[196] Fix | Delete
"fscale # 2^(x * log2(e)) - 2^(int(x * log2(e)))\n\t" \
[197] Fix | Delete
: "=t" (__value), "=u" (__exponent) : "0" (__x)); \
[198] Fix | Delete
__asm __volatile__ \
[199] Fix | Delete
("fscale # 2^int(x * log2(e))\n\t" \
[200] Fix | Delete
: "=t" (__temp) : "0" (1.0), "u" (__exponent)); \
[201] Fix | Delete
__temp -= 1.0; \
[202] Fix | Delete
__temp += __value; \
[203] Fix | Delete
return __temp ? __temp : __x
[204] Fix | Delete
# endif
[205] Fix | Delete
__inline_mathcodeNP_ (long double, __expm1l, __x, __expm1_code)
[206] Fix | Delete
[207] Fix | Delete
# if __GNUC_PREREQ (3, 4)
[208] Fix | Delete
__inline_mathcodeNP_ (long double, __expl, __x, return __builtin_expl (__x))
[209] Fix | Delete
# else
[210] Fix | Delete
# define __exp_code \
[211] Fix | Delete
register long double __value; \
[212] Fix | Delete
register long double __exponent; \
[213] Fix | Delete
__asm __volatile__ \
[214] Fix | Delete
("fldl2e # e^x = 2^(x * log2(e))\n\t" \
[215] Fix | Delete
"fmul %%st(1) # x * log2(e)\n\t" \
[216] Fix | Delete
"fst %%st(1)\n\t" \
[217] Fix | Delete
"frndint # int(x * log2(e))\n\t" \
[218] Fix | Delete
"fxch\n\t" \
[219] Fix | Delete
"fsub %%st(1) # fract(x * log2(e))\n\t" \
[220] Fix | Delete
"f2xm1 # 2^(fract(x * log2(e))) - 1\n\t" \
[221] Fix | Delete
: "=t" (__value), "=u" (__exponent) : "0" (__x)); \
[222] Fix | Delete
__value += 1.0; \
[223] Fix | Delete
__asm __volatile__ \
[224] Fix | Delete
("fscale" \
[225] Fix | Delete
: "=t" (__value) : "0" (__value), "u" (__exponent)); \
[226] Fix | Delete
return __value
[227] Fix | Delete
__inline_mathcodeNP (exp, __x, __exp_code)
[228] Fix | Delete
__inline_mathcodeNP_ (long double, __expl, __x, __exp_code)
[229] Fix | Delete
# endif
[230] Fix | Delete
# endif /* __FAST_MATH__ */
[231] Fix | Delete
[232] Fix | Delete
[233] Fix | Delete
# ifdef __FAST_MATH__
[234] Fix | Delete
# if !__GNUC_PREREQ (3,3)
[235] Fix | Delete
__inline_mathopNP (sqrt, "fsqrt")
[236] Fix | Delete
__inline_mathopNP_ (long double, __sqrtl, "fsqrt")
[237] Fix | Delete
# define __libc_sqrtl(n) __sqrtl (n)
[238] Fix | Delete
# else
[239] Fix | Delete
# define __libc_sqrtl(n) __builtin_sqrtl (n)
[240] Fix | Delete
# endif
[241] Fix | Delete
# endif
[242] Fix | Delete
[243] Fix | Delete
# if __GNUC_PREREQ (2, 8)
[244] Fix | Delete
__inline_mathcodeNP_ (double, fabs, __x, return __builtin_fabs (__x))
[245] Fix | Delete
# ifdef __USE_ISOC99
[246] Fix | Delete
__inline_mathcodeNP_ (float, fabsf, __x, return __builtin_fabsf (__x))
[247] Fix | Delete
__inline_mathcodeNP_ (long double, fabsl, __x, return __builtin_fabsl (__x))
[248] Fix | Delete
# endif
[249] Fix | Delete
__inline_mathcodeNP_ (long double, __fabsl, __x, return __builtin_fabsl (__x))
[250] Fix | Delete
# else
[251] Fix | Delete
__inline_mathop (fabs, "fabs")
[252] Fix | Delete
__inline_mathop_ (long double, __fabsl, "fabs")
[253] Fix | Delete
# endif
[254] Fix | Delete
[255] Fix | Delete
__inline_mathcode_ (long double, __sgn1l, __x, \
[256] Fix | Delete
__extension__ union { long double __xld; unsigned int __xi[3]; } __n = \
[257] Fix | Delete
{ __xld: __x }; \
[258] Fix | Delete
__n.__xi[2] = (__n.__xi[2] & 0x8000) | 0x3fff; \
[259] Fix | Delete
__n.__xi[1] = 0x80000000; \
[260] Fix | Delete
__n.__xi[0] = 0; \
[261] Fix | Delete
return __n.__xld)
[262] Fix | Delete
[263] Fix | Delete
[264] Fix | Delete
# ifdef __FAST_MATH__
[265] Fix | Delete
/* The argument range of the inline version of sinhl is slightly reduced. */
[266] Fix | Delete
__inline_mathcodeNP (sinh, __x, \
[267] Fix | Delete
register long double __exm1 = __expm1l (__fabsl (__x)); \
[268] Fix | Delete
return 0.5 * (__exm1 / (__exm1 + 1.0) + __exm1) * __sgn1l (__x))
[269] Fix | Delete
[270] Fix | Delete
__inline_mathcodeNP (cosh, __x, \
[271] Fix | Delete
register long double __ex = __expl (__x); \
[272] Fix | Delete
return 0.5 * (__ex + 1.0 / __ex))
[273] Fix | Delete
[274] Fix | Delete
__inline_mathcodeNP (tanh, __x, \
[275] Fix | Delete
register long double __exm1 = __expm1l (-__fabsl (__x + __x)); \
[276] Fix | Delete
return __exm1 / (__exm1 + 2.0) * __sgn1l (-__x))
[277] Fix | Delete
# endif
[278] Fix | Delete
[279] Fix | Delete
[280] Fix | Delete
/* Optimized versions for some non-standardized functions. */
[281] Fix | Delete
# ifdef __USE_ISOC99
[282] Fix | Delete
[283] Fix | Delete
# ifdef __FAST_MATH__
[284] Fix | Delete
__inline_mathcodeNP (expm1, __x, __expm1_code)
[285] Fix | Delete
[286] Fix | Delete
/* The argument range of the inline version of asinhl is slightly reduced. */
[287] Fix | Delete
__inline_mathcodeNP (asinh, __x, \
[288] Fix | Delete
register long double __y = __fabsl (__x); \
[289] Fix | Delete
return (log1pl (__y * __y / (__libc_sqrtl (__y * __y + 1.0) + 1.0) + __y) \
[290] Fix | Delete
* __sgn1l (__x)))
[291] Fix | Delete
[292] Fix | Delete
__inline_mathcodeNP (acosh, __x, \
[293] Fix | Delete
return logl (__x + __libc_sqrtl (__x - 1.0) * __libc_sqrtl (__x + 1.0)))
[294] Fix | Delete
[295] Fix | Delete
__inline_mathcodeNP (atanh, __x, \
[296] Fix | Delete
register long double __y = __fabsl (__x); \
[297] Fix | Delete
return -0.5 * log1pl (-(__y + __y) / (1.0 + __y)) * __sgn1l (__x))
[298] Fix | Delete
[299] Fix | Delete
/* The argument range of the inline version of hypotl is slightly reduced. */
[300] Fix | Delete
__inline_mathcodeNP2 (hypot, __x, __y,
[301] Fix | Delete
return __libc_sqrtl (__x * __x + __y * __y))
[302] Fix | Delete
[303] Fix | Delete
# endif
[304] Fix | Delete
# endif
[305] Fix | Delete
[306] Fix | Delete
[307] Fix | Delete
/* Undefine some of the large macros which are not used anymore. */
[308] Fix | Delete
# ifdef __FAST_MATH__
[309] Fix | Delete
# undef __expm1_code
[310] Fix | Delete
# undef __exp_code
[311] Fix | Delete
# endif /* __FAST_MATH__ */
[312] Fix | Delete
[313] Fix | Delete
# endif /* __NO_MATH_INLINES */
[314] Fix | Delete
[315] Fix | Delete
[316] Fix | Delete
/* This code is used internally in the GNU libc. */
[317] Fix | Delete
# ifdef __LIBC_INTERNAL_MATH_INLINES
[318] Fix | Delete
__inline_mathcode2_ (long double, __ieee754_atan2l, __y, __x,
[319] Fix | Delete
register long double __value;
[320] Fix | Delete
__asm __volatile__ ("fpatan\n\t"
[321] Fix | Delete
: "=t" (__value)
[322] Fix | Delete
: "0" (__x), "u" (__y) : "st(1)");
[323] Fix | Delete
return __value;)
[324] Fix | Delete
# endif
[325] Fix | Delete
[326] Fix | Delete
#endif /* !__SSE2_MATH__ && !__x86_64__ */
[327] Fix | Delete
[328] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function