math.h 52 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771
  1. // -*- C++ -*-
  2. //===----------------------------------------------------------------------===//
  3. //
  4. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  5. // See https://llvm.org/LICENSE.txt for license information.
  6. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  7. //
  8. //===----------------------------------------------------------------------===//
  9. #ifndef _LIBCPP_MATH_H
  10. #define _LIBCPP_MATH_H
  11. /*
  12. math.h synopsis
  13. Macros:
  14. HUGE_VAL
  15. HUGE_VALF // C99
  16. HUGE_VALL // C99
  17. INFINITY // C99
  18. NAN // C99
  19. FP_INFINITE // C99
  20. FP_NAN // C99
  21. FP_NORMAL // C99
  22. FP_SUBNORMAL // C99
  23. FP_ZERO // C99
  24. FP_FAST_FMA // C99
  25. FP_FAST_FMAF // C99
  26. FP_FAST_FMAL // C99
  27. FP_ILOGB0 // C99
  28. FP_ILOGBNAN // C99
  29. MATH_ERRNO // C99
  30. MATH_ERREXCEPT // C99
  31. math_errhandling // C99
  32. Types:
  33. float_t // C99
  34. double_t // C99
  35. // C90
  36. floating_point abs(floating_point x);
  37. floating_point acos (arithmetic x);
  38. float acosf(float x);
  39. long double acosl(long double x);
  40. floating_point asin (arithmetic x);
  41. float asinf(float x);
  42. long double asinl(long double x);
  43. floating_point atan (arithmetic x);
  44. float atanf(float x);
  45. long double atanl(long double x);
  46. floating_point atan2 (arithmetic y, arithmetic x);
  47. float atan2f(float y, float x);
  48. long double atan2l(long double y, long double x);
  49. floating_point ceil (arithmetic x);
  50. float ceilf(float x);
  51. long double ceill(long double x);
  52. floating_point cos (arithmetic x);
  53. float cosf(float x);
  54. long double cosl(long double x);
  55. floating_point cosh (arithmetic x);
  56. float coshf(float x);
  57. long double coshl(long double x);
  58. floating_point exp (arithmetic x);
  59. float expf(float x);
  60. long double expl(long double x);
  61. floating_point fabs (arithmetic x);
  62. float fabsf(float x);
  63. long double fabsl(long double x);
  64. floating_point floor (arithmetic x);
  65. float floorf(float x);
  66. long double floorl(long double x);
  67. floating_point fmod (arithmetic x, arithmetic y);
  68. float fmodf(float x, float y);
  69. long double fmodl(long double x, long double y);
  70. floating_point frexp (arithmetic value, int* exp);
  71. float frexpf(float value, int* exp);
  72. long double frexpl(long double value, int* exp);
  73. floating_point ldexp (arithmetic value, int exp);
  74. float ldexpf(float value, int exp);
  75. long double ldexpl(long double value, int exp);
  76. floating_point log (arithmetic x);
  77. float logf(float x);
  78. long double logl(long double x);
  79. floating_point log10 (arithmetic x);
  80. float log10f(float x);
  81. long double log10l(long double x);
  82. floating_point modf (floating_point value, floating_point* iptr);
  83. float modff(float value, float* iptr);
  84. long double modfl(long double value, long double* iptr);
  85. floating_point pow (arithmetic x, arithmetic y);
  86. float powf(float x, float y);
  87. long double powl(long double x, long double y);
  88. floating_point sin (arithmetic x);
  89. float sinf(float x);
  90. long double sinl(long double x);
  91. floating_point sinh (arithmetic x);
  92. float sinhf(float x);
  93. long double sinhl(long double x);
  94. floating_point sqrt (arithmetic x);
  95. float sqrtf(float x);
  96. long double sqrtl(long double x);
  97. floating_point tan (arithmetic x);
  98. float tanf(float x);
  99. long double tanl(long double x);
  100. floating_point tanh (arithmetic x);
  101. float tanhf(float x);
  102. long double tanhl(long double x);
  103. // C99
  104. bool signbit(arithmetic x);
  105. int fpclassify(arithmetic x);
  106. bool isfinite(arithmetic x);
  107. bool isinf(arithmetic x);
  108. bool isnan(arithmetic x);
  109. bool isnormal(arithmetic x);
  110. bool isgreater(arithmetic x, arithmetic y);
  111. bool isgreaterequal(arithmetic x, arithmetic y);
  112. bool isless(arithmetic x, arithmetic y);
  113. bool islessequal(arithmetic x, arithmetic y);
  114. bool islessgreater(arithmetic x, arithmetic y);
  115. bool isunordered(arithmetic x, arithmetic y);
  116. floating_point acosh (arithmetic x);
  117. float acoshf(float x);
  118. long double acoshl(long double x);
  119. floating_point asinh (arithmetic x);
  120. float asinhf(float x);
  121. long double asinhl(long double x);
  122. floating_point atanh (arithmetic x);
  123. float atanhf(float x);
  124. long double atanhl(long double x);
  125. floating_point cbrt (arithmetic x);
  126. float cbrtf(float x);
  127. long double cbrtl(long double x);
  128. floating_point copysign (arithmetic x, arithmetic y);
  129. float copysignf(float x, float y);
  130. long double copysignl(long double x, long double y);
  131. floating_point erf (arithmetic x);
  132. float erff(float x);
  133. long double erfl(long double x);
  134. floating_point erfc (arithmetic x);
  135. float erfcf(float x);
  136. long double erfcl(long double x);
  137. floating_point exp2 (arithmetic x);
  138. float exp2f(float x);
  139. long double exp2l(long double x);
  140. floating_point expm1 (arithmetic x);
  141. float expm1f(float x);
  142. long double expm1l(long double x);
  143. floating_point fdim (arithmetic x, arithmetic y);
  144. float fdimf(float x, float y);
  145. long double fdiml(long double x, long double y);
  146. floating_point fma (arithmetic x, arithmetic y, arithmetic z);
  147. float fmaf(float x, float y, float z);
  148. long double fmal(long double x, long double y, long double z);
  149. floating_point fmax (arithmetic x, arithmetic y);
  150. float fmaxf(float x, float y);
  151. long double fmaxl(long double x, long double y);
  152. floating_point fmin (arithmetic x, arithmetic y);
  153. float fminf(float x, float y);
  154. long double fminl(long double x, long double y);
  155. floating_point hypot (arithmetic x, arithmetic y);
  156. float hypotf(float x, float y);
  157. long double hypotl(long double x, long double y);
  158. int ilogb (arithmetic x);
  159. int ilogbf(float x);
  160. int ilogbl(long double x);
  161. floating_point lgamma (arithmetic x);
  162. float lgammaf(float x);
  163. long double lgammal(long double x);
  164. long long llrint (arithmetic x);
  165. long long llrintf(float x);
  166. long long llrintl(long double x);
  167. long long llround (arithmetic x);
  168. long long llroundf(float x);
  169. long long llroundl(long double x);
  170. floating_point log1p (arithmetic x);
  171. float log1pf(float x);
  172. long double log1pl(long double x);
  173. floating_point log2 (arithmetic x);
  174. float log2f(float x);
  175. long double log2l(long double x);
  176. floating_point logb (arithmetic x);
  177. float logbf(float x);
  178. long double logbl(long double x);
  179. long lrint (arithmetic x);
  180. long lrintf(float x);
  181. long lrintl(long double x);
  182. long lround (arithmetic x);
  183. long lroundf(float x);
  184. long lroundl(long double x);
  185. double nan (const char* str);
  186. float nanf(const char* str);
  187. long double nanl(const char* str);
  188. floating_point nearbyint (arithmetic x);
  189. float nearbyintf(float x);
  190. long double nearbyintl(long double x);
  191. floating_point nextafter (arithmetic x, arithmetic y);
  192. float nextafterf(float x, float y);
  193. long double nextafterl(long double x, long double y);
  194. floating_point nexttoward (arithmetic x, long double y);
  195. float nexttowardf(float x, long double y);
  196. long double nexttowardl(long double x, long double y);
  197. floating_point remainder (arithmetic x, arithmetic y);
  198. float remainderf(float x, float y);
  199. long double remainderl(long double x, long double y);
  200. floating_point remquo (arithmetic x, arithmetic y, int* pquo);
  201. float remquof(float x, float y, int* pquo);
  202. long double remquol(long double x, long double y, int* pquo);
  203. floating_point rint (arithmetic x);
  204. float rintf(float x);
  205. long double rintl(long double x);
  206. floating_point round (arithmetic x);
  207. float roundf(float x);
  208. long double roundl(long double x);
  209. floating_point scalbln (arithmetic x, long ex);
  210. float scalblnf(float x, long ex);
  211. long double scalblnl(long double x, long ex);
  212. floating_point scalbn (arithmetic x, int ex);
  213. float scalbnf(float x, int ex);
  214. long double scalbnl(long double x, int ex);
  215. floating_point tgamma (arithmetic x);
  216. float tgammaf(float x);
  217. long double tgammal(long double x);
  218. floating_point trunc (arithmetic x);
  219. float truncf(float x);
  220. long double truncl(long double x);
  221. */
  222. #include <__config>
  223. #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
  224. # pragma GCC system_header
  225. #endif
  226. #ifdef _LIBCPP_COMPILER_MSVC
  227. #include Y_UCRT_INCLUDE_NEXT(math.h)
  228. #else
  229. #include_next <math.h>
  230. #endif
  231. #ifdef __cplusplus
  232. // We support including .h headers inside 'extern "C"' contexts, so switch
  233. // back to C++ linkage before including these C++ headers.
  234. extern "C++" {
  235. #include <limits>
  236. #include <stdlib.h>
  237. #include <type_traits>
  238. // signbit
  239. #ifdef signbit
  240. template <class _A1>
  241. _LIBCPP_INLINE_VISIBILITY
  242. bool
  243. __libcpp_signbit(_A1 __lcpp_x) _NOEXCEPT
  244. {
  245. #if __has_builtin(__builtin_signbit)
  246. return __builtin_signbit(__lcpp_x);
  247. #else
  248. return signbit(__lcpp_x);
  249. #endif
  250. }
  251. #undef signbit
  252. template <class _A1>
  253. inline _LIBCPP_INLINE_VISIBILITY
  254. typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
  255. signbit(_A1 __lcpp_x) _NOEXCEPT
  256. {
  257. return __libcpp_signbit((typename std::__promote<_A1>::type)__lcpp_x);
  258. }
  259. template <class _A1>
  260. inline _LIBCPP_INLINE_VISIBILITY
  261. typename std::enable_if<
  262. std::is_integral<_A1>::value && std::is_signed<_A1>::value, bool>::type
  263. signbit(_A1 __lcpp_x) _NOEXCEPT
  264. { return __lcpp_x < 0; }
  265. template <class _A1>
  266. inline _LIBCPP_INLINE_VISIBILITY
  267. typename std::enable_if<
  268. std::is_integral<_A1>::value && !std::is_signed<_A1>::value, bool>::type
  269. signbit(_A1) _NOEXCEPT
  270. { return false; }
  271. #elif defined(_LIBCPP_MSVCRT)
  272. template <typename _A1>
  273. inline _LIBCPP_INLINE_VISIBILITY
  274. typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
  275. signbit(_A1 __lcpp_x) _NOEXCEPT
  276. {
  277. return ::signbit(static_cast<typename std::__promote<_A1>::type>(__lcpp_x));
  278. }
  279. template <class _A1>
  280. inline _LIBCPP_INLINE_VISIBILITY
  281. typename std::enable_if<
  282. std::is_integral<_A1>::value && std::is_signed<_A1>::value, bool>::type
  283. signbit(_A1 __lcpp_x) _NOEXCEPT
  284. { return __lcpp_x < 0; }
  285. template <class _A1>
  286. inline _LIBCPP_INLINE_VISIBILITY
  287. typename std::enable_if<
  288. std::is_integral<_A1>::value && !std::is_signed<_A1>::value, bool>::type
  289. signbit(_A1) _NOEXCEPT
  290. { return false; }
  291. #endif // signbit
  292. // fpclassify
  293. #ifdef fpclassify
  294. template <class _A1>
  295. _LIBCPP_INLINE_VISIBILITY
  296. int
  297. __libcpp_fpclassify(_A1 __lcpp_x) _NOEXCEPT
  298. {
  299. #if __has_builtin(__builtin_fpclassify)
  300. return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL,
  301. FP_ZERO, __lcpp_x);
  302. #else
  303. return fpclassify(__lcpp_x);
  304. #endif
  305. }
  306. #undef fpclassify
  307. template <class _A1>
  308. inline _LIBCPP_INLINE_VISIBILITY
  309. typename std::enable_if<std::is_floating_point<_A1>::value, int>::type
  310. fpclassify(_A1 __lcpp_x) _NOEXCEPT
  311. {
  312. return __libcpp_fpclassify((typename std::__promote<_A1>::type)__lcpp_x);
  313. }
  314. template <class _A1>
  315. inline _LIBCPP_INLINE_VISIBILITY
  316. typename std::enable_if<std::is_integral<_A1>::value, int>::type
  317. fpclassify(_A1 __lcpp_x) _NOEXCEPT
  318. { return __lcpp_x == 0 ? FP_ZERO : FP_NORMAL; }
  319. #elif defined(_LIBCPP_MSVCRT)
  320. template <typename _A1>
  321. inline _LIBCPP_INLINE_VISIBILITY
  322. typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
  323. fpclassify(_A1 __lcpp_x) _NOEXCEPT
  324. {
  325. return ::fpclassify(static_cast<typename std::__promote<_A1>::type>(__lcpp_x));
  326. }
  327. template <class _A1>
  328. inline _LIBCPP_INLINE_VISIBILITY
  329. typename std::enable_if<std::is_integral<_A1>::value, int>::type
  330. fpclassify(_A1 __lcpp_x) _NOEXCEPT
  331. { return __lcpp_x == 0 ? FP_ZERO : FP_NORMAL; }
  332. #endif // fpclassify
  333. // isfinite
  334. #ifdef isfinite
  335. template <class _A1>
  336. _LIBCPP_INLINE_VISIBILITY
  337. bool
  338. __libcpp_isfinite(_A1 __lcpp_x) _NOEXCEPT
  339. {
  340. #if __has_builtin(__builtin_isfinite)
  341. return __builtin_isfinite(__lcpp_x);
  342. #else
  343. return isfinite(__lcpp_x);
  344. #endif
  345. }
  346. #undef isfinite
  347. template <class _A1>
  348. inline _LIBCPP_INLINE_VISIBILITY
  349. typename std::enable_if<
  350. std::is_arithmetic<_A1>::value && std::numeric_limits<_A1>::has_infinity,
  351. bool>::type
  352. isfinite(_A1 __lcpp_x) _NOEXCEPT
  353. {
  354. return __libcpp_isfinite((typename std::__promote<_A1>::type)__lcpp_x);
  355. }
  356. template <class _A1>
  357. inline _LIBCPP_INLINE_VISIBILITY
  358. typename std::enable_if<
  359. std::is_arithmetic<_A1>::value && !std::numeric_limits<_A1>::has_infinity,
  360. bool>::type
  361. isfinite(_A1) _NOEXCEPT
  362. { return true; }
  363. #endif // isfinite
  364. // isinf
  365. #ifdef isinf
  366. template <class _A1>
  367. _LIBCPP_INLINE_VISIBILITY
  368. bool
  369. __libcpp_isinf(_A1 __lcpp_x) _NOEXCEPT
  370. {
  371. #if __has_builtin(__builtin_isinf)
  372. return __builtin_isinf(__lcpp_x);
  373. #else
  374. return isinf(__lcpp_x);
  375. #endif
  376. }
  377. #undef isinf
  378. template <class _A1>
  379. inline _LIBCPP_INLINE_VISIBILITY
  380. typename std::enable_if<
  381. std::is_arithmetic<_A1>::value && std::numeric_limits<_A1>::has_infinity,
  382. bool>::type
  383. isinf(_A1 __lcpp_x) _NOEXCEPT
  384. {
  385. return __libcpp_isinf((typename std::__promote<_A1>::type)__lcpp_x);
  386. }
  387. template <class _A1>
  388. inline _LIBCPP_INLINE_VISIBILITY
  389. typename std::enable_if<
  390. std::is_arithmetic<_A1>::value && !std::numeric_limits<_A1>::has_infinity,
  391. bool>::type
  392. isinf(_A1) _NOEXCEPT
  393. { return false; }
  394. #if defined(_LIBCPP_PREFERRED_OVERLOAD) && !defined(__CUDACC__)
  395. inline _LIBCPP_INLINE_VISIBILITY
  396. bool
  397. isinf(float __lcpp_x) _NOEXCEPT { return __libcpp_isinf(__lcpp_x); }
  398. inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
  399. bool
  400. isinf(double __lcpp_x) _NOEXCEPT { return __libcpp_isinf(__lcpp_x); }
  401. inline _LIBCPP_INLINE_VISIBILITY
  402. bool
  403. isinf(long double __lcpp_x) _NOEXCEPT { return __libcpp_isinf(__lcpp_x); }
  404. #endif
  405. #endif // isinf
  406. // isnan
  407. #ifdef isnan
  408. template <class _A1>
  409. _LIBCPP_INLINE_VISIBILITY
  410. bool
  411. __libcpp_isnan(_A1 __lcpp_x) _NOEXCEPT
  412. {
  413. #if __has_builtin(__builtin_isnan)
  414. return __builtin_isnan(__lcpp_x);
  415. #else
  416. return isnan(__lcpp_x);
  417. #endif
  418. }
  419. #undef isnan
  420. template <class _A1>
  421. inline _LIBCPP_INLINE_VISIBILITY
  422. typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
  423. isnan(_A1 __lcpp_x) _NOEXCEPT
  424. {
  425. return __libcpp_isnan((typename std::__promote<_A1>::type)__lcpp_x);
  426. }
  427. template <class _A1>
  428. inline _LIBCPP_INLINE_VISIBILITY
  429. typename std::enable_if<std::is_integral<_A1>::value, bool>::type
  430. isnan(_A1) _NOEXCEPT
  431. { return false; }
  432. #if defined(_LIBCPP_PREFERRED_OVERLOAD) && !defined(__CUDACC__)
  433. inline _LIBCPP_INLINE_VISIBILITY
  434. bool
  435. isnan(float __lcpp_x) _NOEXCEPT { return __libcpp_isnan(__lcpp_x); }
  436. inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
  437. bool
  438. isnan(double __lcpp_x) _NOEXCEPT { return __libcpp_isnan(__lcpp_x); }
  439. inline _LIBCPP_INLINE_VISIBILITY
  440. bool
  441. isnan(long double __lcpp_x) _NOEXCEPT { return __libcpp_isnan(__lcpp_x); }
  442. #endif
  443. #endif // isnan
  444. // isnormal
  445. #ifdef isnormal
  446. template <class _A1>
  447. _LIBCPP_INLINE_VISIBILITY
  448. bool
  449. __libcpp_isnormal(_A1 __lcpp_x) _NOEXCEPT
  450. {
  451. #if __has_builtin(__builtin_isnormal)
  452. return __builtin_isnormal(__lcpp_x);
  453. #else
  454. return isnormal(__lcpp_x);
  455. #endif
  456. }
  457. #undef isnormal
  458. template <class _A1>
  459. inline _LIBCPP_INLINE_VISIBILITY
  460. typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
  461. isnormal(_A1 __lcpp_x) _NOEXCEPT
  462. {
  463. return __libcpp_isnormal((typename std::__promote<_A1>::type)__lcpp_x);
  464. }
  465. template <class _A1>
  466. inline _LIBCPP_INLINE_VISIBILITY
  467. typename std::enable_if<std::is_integral<_A1>::value, bool>::type
  468. isnormal(_A1 __lcpp_x) _NOEXCEPT
  469. { return __lcpp_x != 0; }
  470. #endif // isnormal
  471. // isgreater
  472. #ifdef isgreater
  473. template <class _A1, class _A2>
  474. _LIBCPP_INLINE_VISIBILITY
  475. bool
  476. __libcpp_isgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
  477. {
  478. return isgreater(__lcpp_x, __lcpp_y);
  479. }
  480. #undef isgreater
  481. template <class _A1, class _A2>
  482. inline _LIBCPP_INLINE_VISIBILITY
  483. typename std::enable_if
  484. <
  485. std::is_arithmetic<_A1>::value &&
  486. std::is_arithmetic<_A2>::value,
  487. bool
  488. >::type
  489. isgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
  490. {
  491. typedef typename std::__promote<_A1, _A2>::type type;
  492. return __libcpp_isgreater((type)__lcpp_x, (type)__lcpp_y);
  493. }
  494. #endif // isgreater
  495. // isgreaterequal
  496. #ifdef isgreaterequal
  497. template <class _A1, class _A2>
  498. _LIBCPP_INLINE_VISIBILITY
  499. bool
  500. __libcpp_isgreaterequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
  501. {
  502. return isgreaterequal(__lcpp_x, __lcpp_y);
  503. }
  504. #undef isgreaterequal
  505. template <class _A1, class _A2>
  506. inline _LIBCPP_INLINE_VISIBILITY
  507. typename std::enable_if
  508. <
  509. std::is_arithmetic<_A1>::value &&
  510. std::is_arithmetic<_A2>::value,
  511. bool
  512. >::type
  513. isgreaterequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
  514. {
  515. typedef typename std::__promote<_A1, _A2>::type type;
  516. return __libcpp_isgreaterequal((type)__lcpp_x, (type)__lcpp_y);
  517. }
  518. #endif // isgreaterequal
  519. // isless
  520. #ifdef isless
  521. template <class _A1, class _A2>
  522. _LIBCPP_INLINE_VISIBILITY
  523. bool
  524. __libcpp_isless(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
  525. {
  526. return isless(__lcpp_x, __lcpp_y);
  527. }
  528. #undef isless
  529. template <class _A1, class _A2>
  530. inline _LIBCPP_INLINE_VISIBILITY
  531. typename std::enable_if
  532. <
  533. std::is_arithmetic<_A1>::value &&
  534. std::is_arithmetic<_A2>::value,
  535. bool
  536. >::type
  537. isless(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
  538. {
  539. typedef typename std::__promote<_A1, _A2>::type type;
  540. return __libcpp_isless((type)__lcpp_x, (type)__lcpp_y);
  541. }
  542. #endif // isless
  543. // islessequal
  544. #ifdef islessequal
  545. template <class _A1, class _A2>
  546. _LIBCPP_INLINE_VISIBILITY
  547. bool
  548. __libcpp_islessequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
  549. {
  550. return islessequal(__lcpp_x, __lcpp_y);
  551. }
  552. #undef islessequal
  553. template <class _A1, class _A2>
  554. inline _LIBCPP_INLINE_VISIBILITY
  555. typename std::enable_if
  556. <
  557. std::is_arithmetic<_A1>::value &&
  558. std::is_arithmetic<_A2>::value,
  559. bool
  560. >::type
  561. islessequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
  562. {
  563. typedef typename std::__promote<_A1, _A2>::type type;
  564. return __libcpp_islessequal((type)__lcpp_x, (type)__lcpp_y);
  565. }
  566. #endif // islessequal
  567. // islessgreater
  568. #ifdef islessgreater
  569. template <class _A1, class _A2>
  570. _LIBCPP_INLINE_VISIBILITY
  571. bool
  572. __libcpp_islessgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
  573. {
  574. return islessgreater(__lcpp_x, __lcpp_y);
  575. }
  576. #undef islessgreater
  577. template <class _A1, class _A2>
  578. inline _LIBCPP_INLINE_VISIBILITY
  579. typename std::enable_if
  580. <
  581. std::is_arithmetic<_A1>::value &&
  582. std::is_arithmetic<_A2>::value,
  583. bool
  584. >::type
  585. islessgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
  586. {
  587. typedef typename std::__promote<_A1, _A2>::type type;
  588. return __libcpp_islessgreater((type)__lcpp_x, (type)__lcpp_y);
  589. }
  590. #endif // islessgreater
  591. // isunordered
  592. #ifdef isunordered
  593. template <class _A1, class _A2>
  594. _LIBCPP_INLINE_VISIBILITY
  595. bool
  596. __libcpp_isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
  597. {
  598. return isunordered(__lcpp_x, __lcpp_y);
  599. }
  600. #undef isunordered
  601. template <class _A1, class _A2>
  602. inline _LIBCPP_INLINE_VISIBILITY
  603. typename std::enable_if
  604. <
  605. std::is_arithmetic<_A1>::value &&
  606. std::is_arithmetic<_A2>::value,
  607. bool
  608. >::type
  609. isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
  610. {
  611. typedef typename std::__promote<_A1, _A2>::type type;
  612. return __libcpp_isunordered((type)__lcpp_x, (type)__lcpp_y);
  613. }
  614. #endif // isunordered
  615. // abs
  616. //
  617. // handled in stdlib.h
  618. // div
  619. //
  620. // handled in stdlib.h
  621. // acos
  622. #if !(defined(_AIX) || defined(__sun__))
  623. inline _LIBCPP_INLINE_VISIBILITY float acos(float __lcpp_x) _NOEXCEPT {return ::acosf(__lcpp_x);}
  624. inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __lcpp_x) _NOEXCEPT {return ::acosl(__lcpp_x);}
  625. #endif
  626. template <class _A1>
  627. inline _LIBCPP_INLINE_VISIBILITY
  628. typename std::enable_if<std::is_integral<_A1>::value, double>::type
  629. acos(_A1 __lcpp_x) _NOEXCEPT {return ::acos((double)__lcpp_x);}
  630. // asin
  631. #if !(defined(_AIX) || defined(__sun__))
  632. inline _LIBCPP_INLINE_VISIBILITY float asin(float __lcpp_x) _NOEXCEPT {return ::asinf(__lcpp_x);}
  633. inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __lcpp_x) _NOEXCEPT {return ::asinl(__lcpp_x);}
  634. #endif
  635. template <class _A1>
  636. inline _LIBCPP_INLINE_VISIBILITY
  637. typename std::enable_if<std::is_integral<_A1>::value, double>::type
  638. asin(_A1 __lcpp_x) _NOEXCEPT {return ::asin((double)__lcpp_x);}
  639. // atan
  640. #if !(defined(_AIX) || defined(__sun__))
  641. inline _LIBCPP_INLINE_VISIBILITY float atan(float __lcpp_x) _NOEXCEPT {return ::atanf(__lcpp_x);}
  642. inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __lcpp_x) _NOEXCEPT {return ::atanl(__lcpp_x);}
  643. #endif
  644. template <class _A1>
  645. inline _LIBCPP_INLINE_VISIBILITY
  646. typename std::enable_if<std::is_integral<_A1>::value, double>::type
  647. atan(_A1 __lcpp_x) _NOEXCEPT {return ::atan((double)__lcpp_x);}
  648. // atan2
  649. #if !(defined(_AIX) || defined(__sun__))
  650. inline _LIBCPP_INLINE_VISIBILITY float atan2(float __lcpp_y, float __lcpp_x) _NOEXCEPT {return ::atan2f(__lcpp_y, __lcpp_x);}
  651. inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __lcpp_y, long double __lcpp_x) _NOEXCEPT {return ::atan2l(__lcpp_y, __lcpp_x);}
  652. #endif
  653. template <class _A1, class _A2>
  654. inline _LIBCPP_INLINE_VISIBILITY
  655. typename std::__enable_if_t
  656. <
  657. std::is_arithmetic<_A1>::value &&
  658. std::is_arithmetic<_A2>::value,
  659. std::__promote<_A1, _A2>
  660. >::type
  661. atan2(_A1 __lcpp_y, _A2 __lcpp_x) _NOEXCEPT
  662. {
  663. typedef typename std::__promote<_A1, _A2>::type __result_type;
  664. static_assert((!(std::_IsSame<_A1, __result_type>::value &&
  665. std::_IsSame<_A2, __result_type>::value)), "");
  666. return ::atan2((__result_type)__lcpp_y, (__result_type)__lcpp_x);
  667. }
  668. // ceil
  669. #if !(defined(_AIX) || defined(__sun__))
  670. inline _LIBCPP_INLINE_VISIBILITY float ceil(float __lcpp_x) _NOEXCEPT {return ::ceilf(__lcpp_x);}
  671. inline _LIBCPP_INLINE_VISIBILITY long double ceil(long double __lcpp_x) _NOEXCEPT {return ::ceill(__lcpp_x);}
  672. #endif
  673. template <class _A1>
  674. inline _LIBCPP_INLINE_VISIBILITY
  675. typename std::enable_if<std::is_integral<_A1>::value, double>::type
  676. ceil(_A1 __lcpp_x) _NOEXCEPT {return ::ceil((double)__lcpp_x);}
  677. // cos
  678. #if !(defined(_AIX) || defined(__sun__))
  679. inline _LIBCPP_INLINE_VISIBILITY float cos(float __lcpp_x) _NOEXCEPT {return ::cosf(__lcpp_x);}
  680. inline _LIBCPP_INLINE_VISIBILITY long double cos(long double __lcpp_x) _NOEXCEPT {return ::cosl(__lcpp_x);}
  681. #endif
  682. template <class _A1>
  683. inline _LIBCPP_INLINE_VISIBILITY
  684. typename std::enable_if<std::is_integral<_A1>::value, double>::type
  685. cos(_A1 __lcpp_x) _NOEXCEPT {return ::cos((double)__lcpp_x);}
  686. // cosh
  687. #if !(defined(_AIX) || defined(__sun__))
  688. inline _LIBCPP_INLINE_VISIBILITY float cosh(float __lcpp_x) _NOEXCEPT {return ::coshf(__lcpp_x);}
  689. inline _LIBCPP_INLINE_VISIBILITY long double cosh(long double __lcpp_x) _NOEXCEPT {return ::coshl(__lcpp_x);}
  690. #endif
  691. template <class _A1>
  692. inline _LIBCPP_INLINE_VISIBILITY
  693. typename std::enable_if<std::is_integral<_A1>::value, double>::type
  694. cosh(_A1 __lcpp_x) _NOEXCEPT {return ::cosh((double)__lcpp_x);}
  695. // exp
  696. #if !(defined(_AIX) || defined(__sun__))
  697. inline _LIBCPP_INLINE_VISIBILITY float exp(float __lcpp_x) _NOEXCEPT {return ::expf(__lcpp_x);}
  698. inline _LIBCPP_INLINE_VISIBILITY long double exp(long double __lcpp_x) _NOEXCEPT {return ::expl(__lcpp_x);}
  699. #endif
  700. template <class _A1>
  701. inline _LIBCPP_INLINE_VISIBILITY
  702. typename std::enable_if<std::is_integral<_A1>::value, double>::type
  703. exp(_A1 __lcpp_x) _NOEXCEPT {return ::exp((double)__lcpp_x);}
  704. // fabs
  705. #if !(defined(_AIX) || defined(__sun__))
  706. inline _LIBCPP_INLINE_VISIBILITY float fabs(float __lcpp_x) _NOEXCEPT {return ::fabsf(__lcpp_x);}
  707. inline _LIBCPP_INLINE_VISIBILITY long double fabs(long double __lcpp_x) _NOEXCEPT {return ::fabsl(__lcpp_x);}
  708. #endif
  709. template <class _A1>
  710. inline _LIBCPP_INLINE_VISIBILITY
  711. typename std::enable_if<std::is_integral<_A1>::value, double>::type
  712. fabs(_A1 __lcpp_x) _NOEXCEPT {return ::fabs((double)__lcpp_x);}
  713. // floor
  714. #if !(defined(_AIX) || defined(__sun__))
  715. inline _LIBCPP_INLINE_VISIBILITY float floor(float __lcpp_x) _NOEXCEPT {return ::floorf(__lcpp_x);}
  716. inline _LIBCPP_INLINE_VISIBILITY long double floor(long double __lcpp_x) _NOEXCEPT {return ::floorl(__lcpp_x);}
  717. #endif
  718. template <class _A1>
  719. inline _LIBCPP_INLINE_VISIBILITY
  720. typename std::enable_if<std::is_integral<_A1>::value, double>::type
  721. floor(_A1 __lcpp_x) _NOEXCEPT {return ::floor((double)__lcpp_x);}
  722. // fmod
  723. #if !(defined(_AIX) || defined(__sun__))
  724. inline _LIBCPP_INLINE_VISIBILITY float fmod(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fmodf(__lcpp_x, __lcpp_y);}
  725. inline _LIBCPP_INLINE_VISIBILITY long double fmod(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fmodl(__lcpp_x, __lcpp_y);}
  726. #endif
  727. template <class _A1, class _A2>
  728. inline _LIBCPP_INLINE_VISIBILITY
  729. typename std::__enable_if_t
  730. <
  731. std::is_arithmetic<_A1>::value &&
  732. std::is_arithmetic<_A2>::value,
  733. std::__promote<_A1, _A2>
  734. >::type
  735. fmod(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
  736. {
  737. typedef typename std::__promote<_A1, _A2>::type __result_type;
  738. static_assert((!(std::_IsSame<_A1, __result_type>::value &&
  739. std::_IsSame<_A2, __result_type>::value)), "");
  740. return ::fmod((__result_type)__lcpp_x, (__result_type)__lcpp_y);
  741. }
  742. // frexp
  743. #if !(defined(_AIX) || defined(__sun__))
  744. inline _LIBCPP_INLINE_VISIBILITY float frexp(float __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexpf(__lcpp_x, __lcpp_e);}
  745. inline _LIBCPP_INLINE_VISIBILITY long double frexp(long double __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexpl(__lcpp_x, __lcpp_e);}
  746. #endif
  747. template <class _A1>
  748. inline _LIBCPP_INLINE_VISIBILITY
  749. typename std::enable_if<std::is_integral<_A1>::value, double>::type
  750. frexp(_A1 __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexp((double)__lcpp_x, __lcpp_e);}
  751. // ldexp
  752. #if !(defined(_AIX) || defined(__sun__))
  753. inline _LIBCPP_INLINE_VISIBILITY float ldexp(float __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexpf(__lcpp_x, __lcpp_e);}
  754. inline _LIBCPP_INLINE_VISIBILITY long double ldexp(long double __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexpl(__lcpp_x, __lcpp_e);}
  755. #endif
  756. template <class _A1>
  757. inline _LIBCPP_INLINE_VISIBILITY
  758. typename std::enable_if<std::is_integral<_A1>::value, double>::type
  759. ldexp(_A1 __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexp((double)__lcpp_x, __lcpp_e);}
  760. // log
  761. #if !(defined(_AIX) || defined(__sun__))
  762. inline _LIBCPP_INLINE_VISIBILITY float log(float __lcpp_x) _NOEXCEPT {return ::logf(__lcpp_x);}
  763. inline _LIBCPP_INLINE_VISIBILITY long double log(long double __lcpp_x) _NOEXCEPT {return ::logl(__lcpp_x);}
  764. #endif
  765. template <class _A1>
  766. inline _LIBCPP_INLINE_VISIBILITY
  767. typename std::enable_if<std::is_integral<_A1>::value, double>::type
  768. log(_A1 __lcpp_x) _NOEXCEPT {return ::log((double)__lcpp_x);}
  769. // log10
  770. #if !(defined(_AIX) || defined(__sun__))
  771. inline _LIBCPP_INLINE_VISIBILITY float log10(float __lcpp_x) _NOEXCEPT {return ::log10f(__lcpp_x);}
  772. inline _LIBCPP_INLINE_VISIBILITY long double log10(long double __lcpp_x) _NOEXCEPT {return ::log10l(__lcpp_x);}
  773. #endif
  774. template <class _A1>
  775. inline _LIBCPP_INLINE_VISIBILITY
  776. typename std::enable_if<std::is_integral<_A1>::value, double>::type
  777. log10(_A1 __lcpp_x) _NOEXCEPT {return ::log10((double)__lcpp_x);}
  778. // modf
  779. #if !(defined(_AIX) || defined(__sun__))
  780. inline _LIBCPP_INLINE_VISIBILITY float modf(float __lcpp_x, float* __lcpp_y) _NOEXCEPT {return ::modff(__lcpp_x, __lcpp_y);}
  781. inline _LIBCPP_INLINE_VISIBILITY long double modf(long double __lcpp_x, long double* __lcpp_y) _NOEXCEPT {return ::modfl(__lcpp_x, __lcpp_y);}
  782. #endif
  783. // pow
  784. #if !(defined(_AIX) || defined(__sun__))
  785. inline _LIBCPP_INLINE_VISIBILITY float pow(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::powf(__lcpp_x, __lcpp_y);}
  786. inline _LIBCPP_INLINE_VISIBILITY long double pow(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::powl(__lcpp_x, __lcpp_y);}
  787. #endif
  788. template <class _A1, class _A2>
  789. inline _LIBCPP_INLINE_VISIBILITY
  790. typename std::__enable_if_t
  791. <
  792. std::is_arithmetic<_A1>::value &&
  793. std::is_arithmetic<_A2>::value,
  794. std::__promote<_A1, _A2>
  795. >::type
  796. pow(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
  797. {
  798. typedef typename std::__promote<_A1, _A2>::type __result_type;
  799. static_assert((!(std::_IsSame<_A1, __result_type>::value &&
  800. std::_IsSame<_A2, __result_type>::value)), "");
  801. return ::pow((__result_type)__lcpp_x, (__result_type)__lcpp_y);
  802. }
  803. // sin
  804. #if !(defined(_AIX) || defined(__sun__))
  805. inline _LIBCPP_INLINE_VISIBILITY float sin(float __lcpp_x) _NOEXCEPT {return ::sinf(__lcpp_x);}
  806. inline _LIBCPP_INLINE_VISIBILITY long double sin(long double __lcpp_x) _NOEXCEPT {return ::sinl(__lcpp_x);}
  807. #endif
  808. template <class _A1>
  809. inline _LIBCPP_INLINE_VISIBILITY
  810. typename std::enable_if<std::is_integral<_A1>::value, double>::type
  811. sin(_A1 __lcpp_x) _NOEXCEPT {return ::sin((double)__lcpp_x);}
  812. // sinh
  813. #if !(defined(_AIX) || defined(__sun__))
  814. inline _LIBCPP_INLINE_VISIBILITY float sinh(float __lcpp_x) _NOEXCEPT {return ::sinhf(__lcpp_x);}
  815. inline _LIBCPP_INLINE_VISIBILITY long double sinh(long double __lcpp_x) _NOEXCEPT {return ::sinhl(__lcpp_x);}
  816. #endif
  817. template <class _A1>
  818. inline _LIBCPP_INLINE_VISIBILITY
  819. typename std::enable_if<std::is_integral<_A1>::value, double>::type
  820. sinh(_A1 __lcpp_x) _NOEXCEPT {return ::sinh((double)__lcpp_x);}
  821. // sqrt
  822. #if !(defined(_AIX) || defined(__sun__))
  823. inline _LIBCPP_INLINE_VISIBILITY float sqrt(float __lcpp_x) _NOEXCEPT {return ::sqrtf(__lcpp_x);}
  824. inline _LIBCPP_INLINE_VISIBILITY long double sqrt(long double __lcpp_x) _NOEXCEPT {return ::sqrtl(__lcpp_x);}
  825. #endif
  826. template <class _A1>
  827. inline _LIBCPP_INLINE_VISIBILITY
  828. typename std::enable_if<std::is_integral<_A1>::value, double>::type
  829. sqrt(_A1 __lcpp_x) _NOEXCEPT {return ::sqrt((double)__lcpp_x);}
  830. // tan
  831. #if !(defined(_AIX) || defined(__sun__))
  832. inline _LIBCPP_INLINE_VISIBILITY float tan(float __lcpp_x) _NOEXCEPT {return ::tanf(__lcpp_x);}
  833. inline _LIBCPP_INLINE_VISIBILITY long double tan(long double __lcpp_x) _NOEXCEPT {return ::tanl(__lcpp_x);}
  834. #endif
  835. template <class _A1>
  836. inline _LIBCPP_INLINE_VISIBILITY
  837. typename std::enable_if<std::is_integral<_A1>::value, double>::type
  838. tan(_A1 __lcpp_x) _NOEXCEPT {return ::tan((double)__lcpp_x);}
  839. // tanh
  840. #if !(defined(_AIX) || defined(__sun__))
  841. inline _LIBCPP_INLINE_VISIBILITY float tanh(float __lcpp_x) _NOEXCEPT {return ::tanhf(__lcpp_x);}
  842. inline _LIBCPP_INLINE_VISIBILITY long double tanh(long double __lcpp_x) _NOEXCEPT {return ::tanhl(__lcpp_x);}
  843. #endif
  844. template <class _A1>
  845. inline _LIBCPP_INLINE_VISIBILITY
  846. typename std::enable_if<std::is_integral<_A1>::value, double>::type
  847. tanh(_A1 __lcpp_x) _NOEXCEPT {return ::tanh((double)__lcpp_x);}
  848. // acosh
  849. inline _LIBCPP_INLINE_VISIBILITY float acosh(float __lcpp_x) _NOEXCEPT {return ::acoshf(__lcpp_x);}
  850. inline _LIBCPP_INLINE_VISIBILITY long double acosh(long double __lcpp_x) _NOEXCEPT {return ::acoshl(__lcpp_x);}
  851. template <class _A1>
  852. inline _LIBCPP_INLINE_VISIBILITY
  853. typename std::enable_if<std::is_integral<_A1>::value, double>::type
  854. acosh(_A1 __lcpp_x) _NOEXCEPT {return ::acosh((double)__lcpp_x);}
  855. // asinh
  856. inline _LIBCPP_INLINE_VISIBILITY float asinh(float __lcpp_x) _NOEXCEPT {return ::asinhf(__lcpp_x);}
  857. inline _LIBCPP_INLINE_VISIBILITY long double asinh(long double __lcpp_x) _NOEXCEPT {return ::asinhl(__lcpp_x);}
  858. template <class _A1>
  859. inline _LIBCPP_INLINE_VISIBILITY
  860. typename std::enable_if<std::is_integral<_A1>::value, double>::type
  861. asinh(_A1 __lcpp_x) _NOEXCEPT {return ::asinh((double)__lcpp_x);}
  862. // atanh
  863. inline _LIBCPP_INLINE_VISIBILITY float atanh(float __lcpp_x) _NOEXCEPT {return ::atanhf(__lcpp_x);}
  864. inline _LIBCPP_INLINE_VISIBILITY long double atanh(long double __lcpp_x) _NOEXCEPT {return ::atanhl(__lcpp_x);}
  865. template <class _A1>
  866. inline _LIBCPP_INLINE_VISIBILITY
  867. typename std::enable_if<std::is_integral<_A1>::value, double>::type
  868. atanh(_A1 __lcpp_x) _NOEXCEPT {return ::atanh((double)__lcpp_x);}
  869. // cbrt
  870. inline _LIBCPP_INLINE_VISIBILITY float cbrt(float __lcpp_x) _NOEXCEPT {return ::cbrtf(__lcpp_x);}
  871. inline _LIBCPP_INLINE_VISIBILITY long double cbrt(long double __lcpp_x) _NOEXCEPT {return ::cbrtl(__lcpp_x);}
  872. template <class _A1>
  873. inline _LIBCPP_INLINE_VISIBILITY
  874. typename std::enable_if<std::is_integral<_A1>::value, double>::type
  875. cbrt(_A1 __lcpp_x) _NOEXCEPT {return ::cbrt((double)__lcpp_x);}
  876. // copysign
  877. #if __has_builtin(__builtin_copysignf)
  878. _LIBCPP_CONSTEXPR
  879. #endif
  880. inline _LIBCPP_INLINE_VISIBILITY float __libcpp_copysign(float __lcpp_x, float __lcpp_y) _NOEXCEPT {
  881. #if __has_builtin(__builtin_copysignf)
  882. return __builtin_copysignf(__lcpp_x, __lcpp_y);
  883. #else
  884. return ::copysignf(__lcpp_x, __lcpp_y);
  885. #endif
  886. }
  887. #if __has_builtin(__builtin_copysign)
  888. _LIBCPP_CONSTEXPR
  889. #endif
  890. inline _LIBCPP_INLINE_VISIBILITY double __libcpp_copysign(double __lcpp_x, double __lcpp_y) _NOEXCEPT {
  891. #if __has_builtin(__builtin_copysign)
  892. return __builtin_copysign(__lcpp_x, __lcpp_y);
  893. #else
  894. return ::copysign(__lcpp_x, __lcpp_y);
  895. #endif
  896. }
  897. #if __has_builtin(__builtin_copysignl)
  898. _LIBCPP_CONSTEXPR
  899. #endif
  900. inline _LIBCPP_INLINE_VISIBILITY long double __libcpp_copysign(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {
  901. #if __has_builtin(__builtin_copysignl)
  902. return __builtin_copysignl(__lcpp_x, __lcpp_y);
  903. #else
  904. return ::copysignl(__lcpp_x, __lcpp_y);
  905. #endif
  906. }
  907. template <class _A1, class _A2>
  908. #if __has_builtin(__builtin_copysign)
  909. _LIBCPP_CONSTEXPR
  910. #endif
  911. inline _LIBCPP_INLINE_VISIBILITY
  912. typename std::__enable_if_t
  913. <
  914. std::is_arithmetic<_A1>::value &&
  915. std::is_arithmetic<_A2>::value,
  916. std::__promote<_A1, _A2>
  917. >::type
  918. __libcpp_copysign(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT {
  919. typedef typename std::__promote<_A1, _A2>::type __result_type;
  920. static_assert((!(std::_IsSame<_A1, __result_type>::value &&
  921. std::_IsSame<_A2, __result_type>::value)), "");
  922. #if __has_builtin(__builtin_copysign)
  923. return __builtin_copysign((__result_type)__lcpp_x, (__result_type)__lcpp_y);
  924. #else
  925. return ::copysign((__result_type)__lcpp_x, (__result_type)__lcpp_y);
  926. #endif
  927. }
  928. inline _LIBCPP_INLINE_VISIBILITY float copysign(float __lcpp_x, float __lcpp_y) _NOEXCEPT {
  929. return ::__libcpp_copysign(__lcpp_x, __lcpp_y);
  930. }
  931. inline _LIBCPP_INLINE_VISIBILITY long double copysign(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {
  932. return ::__libcpp_copysign(__lcpp_x, __lcpp_y);
  933. }
  934. template <class _A1, class _A2>
  935. inline _LIBCPP_INLINE_VISIBILITY
  936. typename std::__enable_if_t
  937. <
  938. std::is_arithmetic<_A1>::value &&
  939. std::is_arithmetic<_A2>::value,
  940. std::__promote<_A1, _A2>
  941. >::type
  942. copysign(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT {
  943. return ::__libcpp_copysign(__lcpp_x, __lcpp_y);
  944. }
  945. // erf
  946. inline _LIBCPP_INLINE_VISIBILITY float erf(float __lcpp_x) _NOEXCEPT {return ::erff(__lcpp_x);}
  947. inline _LIBCPP_INLINE_VISIBILITY long double erf(long double __lcpp_x) _NOEXCEPT {return ::erfl(__lcpp_x);}
  948. template <class _A1>
  949. inline _LIBCPP_INLINE_VISIBILITY
  950. typename std::enable_if<std::is_integral<_A1>::value, double>::type
  951. erf(_A1 __lcpp_x) _NOEXCEPT {return ::erf((double)__lcpp_x);}
  952. // erfc
  953. inline _LIBCPP_INLINE_VISIBILITY float erfc(float __lcpp_x) _NOEXCEPT {return ::erfcf(__lcpp_x);}
  954. inline _LIBCPP_INLINE_VISIBILITY long double erfc(long double __lcpp_x) _NOEXCEPT {return ::erfcl(__lcpp_x);}
  955. template <class _A1>
  956. inline _LIBCPP_INLINE_VISIBILITY
  957. typename std::enable_if<std::is_integral<_A1>::value, double>::type
  958. erfc(_A1 __lcpp_x) _NOEXCEPT {return ::erfc((double)__lcpp_x);}
  959. // exp2
  960. inline _LIBCPP_INLINE_VISIBILITY float exp2(float __lcpp_x) _NOEXCEPT {return ::exp2f(__lcpp_x);}
  961. inline _LIBCPP_INLINE_VISIBILITY long double exp2(long double __lcpp_x) _NOEXCEPT {return ::exp2l(__lcpp_x);}
  962. template <class _A1>
  963. inline _LIBCPP_INLINE_VISIBILITY
  964. typename std::enable_if<std::is_integral<_A1>::value, double>::type
  965. exp2(_A1 __lcpp_x) _NOEXCEPT {return ::exp2((double)__lcpp_x);}
  966. // expm1
  967. inline _LIBCPP_INLINE_VISIBILITY float expm1(float __lcpp_x) _NOEXCEPT {return ::expm1f(__lcpp_x);}
  968. inline _LIBCPP_INLINE_VISIBILITY long double expm1(long double __lcpp_x) _NOEXCEPT {return ::expm1l(__lcpp_x);}
  969. template <class _A1>
  970. inline _LIBCPP_INLINE_VISIBILITY
  971. typename std::enable_if<std::is_integral<_A1>::value, double>::type
  972. expm1(_A1 __lcpp_x) _NOEXCEPT {return ::expm1((double)__lcpp_x);}
  973. // fdim
  974. inline _LIBCPP_INLINE_VISIBILITY float fdim(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fdimf(__lcpp_x, __lcpp_y);}
  975. inline _LIBCPP_INLINE_VISIBILITY long double fdim(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fdiml(__lcpp_x, __lcpp_y);}
  976. template <class _A1, class _A2>
  977. inline _LIBCPP_INLINE_VISIBILITY
  978. typename std::__enable_if_t
  979. <
  980. std::is_arithmetic<_A1>::value &&
  981. std::is_arithmetic<_A2>::value,
  982. std::__promote<_A1, _A2>
  983. >::type
  984. fdim(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
  985. {
  986. typedef typename std::__promote<_A1, _A2>::type __result_type;
  987. static_assert((!(std::_IsSame<_A1, __result_type>::value &&
  988. std::_IsSame<_A2, __result_type>::value)), "");
  989. return ::fdim((__result_type)__lcpp_x, (__result_type)__lcpp_y);
  990. }
  991. // fma
  992. inline _LIBCPP_INLINE_VISIBILITY float fma(float __lcpp_x, float __lcpp_y, float __lcpp_z) _NOEXCEPT
  993. {
  994. #if __has_builtin(__builtin_fmaf)
  995. return __builtin_fmaf(__lcpp_x, __lcpp_y, __lcpp_z);
  996. #else
  997. return ::fmaf(__lcpp_x, __lcpp_y, __lcpp_z);
  998. #endif
  999. }
  1000. inline _LIBCPP_INLINE_VISIBILITY long double fma(long double __lcpp_x, long double __lcpp_y, long double __lcpp_z) _NOEXCEPT
  1001. {
  1002. #if __has_builtin(__builtin_fmal)
  1003. return __builtin_fmal(__lcpp_x, __lcpp_y, __lcpp_z);
  1004. #else
  1005. return ::fmal(__lcpp_x, __lcpp_y, __lcpp_z);
  1006. #endif
  1007. }
  1008. template <class _A1, class _A2, class _A3>
  1009. inline _LIBCPP_INLINE_VISIBILITY
  1010. typename std::__enable_if_t
  1011. <
  1012. std::is_arithmetic<_A1>::value &&
  1013. std::is_arithmetic<_A2>::value &&
  1014. std::is_arithmetic<_A3>::value,
  1015. std::__promote<_A1, _A2, _A3>
  1016. >::type
  1017. fma(_A1 __lcpp_x, _A2 __lcpp_y, _A3 __lcpp_z) _NOEXCEPT
  1018. {
  1019. typedef typename std::__promote<_A1, _A2, _A3>::type __result_type;
  1020. static_assert((!(std::_IsSame<_A1, __result_type>::value &&
  1021. std::_IsSame<_A2, __result_type>::value &&
  1022. std::_IsSame<_A3, __result_type>::value)), "");
  1023. #if __has_builtin(__builtin_fma)
  1024. return __builtin_fma((__result_type)__lcpp_x, (__result_type)__lcpp_y, (__result_type)__lcpp_z);
  1025. #else
  1026. return ::fma((__result_type)__lcpp_x, (__result_type)__lcpp_y, (__result_type)__lcpp_z);
  1027. #endif
  1028. }
  1029. // fmax
  1030. inline _LIBCPP_INLINE_VISIBILITY float fmax(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fmaxf(__lcpp_x, __lcpp_y);}
  1031. inline _LIBCPP_INLINE_VISIBILITY long double fmax(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fmaxl(__lcpp_x, __lcpp_y);}
  1032. template <class _A1, class _A2>
  1033. inline _LIBCPP_INLINE_VISIBILITY
  1034. typename std::__enable_if_t
  1035. <
  1036. std::is_arithmetic<_A1>::value &&
  1037. std::is_arithmetic<_A2>::value,
  1038. std::__promote<_A1, _A2>
  1039. >::type
  1040. fmax(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
  1041. {
  1042. typedef typename std::__promote<_A1, _A2>::type __result_type;
  1043. static_assert((!(std::_IsSame<_A1, __result_type>::value &&
  1044. std::_IsSame<_A2, __result_type>::value)), "");
  1045. return ::fmax((__result_type)__lcpp_x, (__result_type)__lcpp_y);
  1046. }
  1047. // fmin
  1048. inline _LIBCPP_INLINE_VISIBILITY float fmin(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fminf(__lcpp_x, __lcpp_y);}
  1049. inline _LIBCPP_INLINE_VISIBILITY long double fmin(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fminl(__lcpp_x, __lcpp_y);}
  1050. template <class _A1, class _A2>
  1051. inline _LIBCPP_INLINE_VISIBILITY
  1052. typename std::__enable_if_t
  1053. <
  1054. std::is_arithmetic<_A1>::value &&
  1055. std::is_arithmetic<_A2>::value,
  1056. std::__promote<_A1, _A2>
  1057. >::type
  1058. fmin(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
  1059. {
  1060. typedef typename std::__promote<_A1, _A2>::type __result_type;
  1061. static_assert((!(std::_IsSame<_A1, __result_type>::value &&
  1062. std::_IsSame<_A2, __result_type>::value)), "");
  1063. return ::fmin((__result_type)__lcpp_x, (__result_type)__lcpp_y);
  1064. }
  1065. // hypot
  1066. inline _LIBCPP_INLINE_VISIBILITY float hypot(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::hypotf(__lcpp_x, __lcpp_y);}
  1067. inline _LIBCPP_INLINE_VISIBILITY long double hypot(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::hypotl(__lcpp_x, __lcpp_y);}
  1068. template <class _A1, class _A2>
  1069. inline _LIBCPP_INLINE_VISIBILITY
  1070. typename std::__enable_if_t
  1071. <
  1072. std::is_arithmetic<_A1>::value &&
  1073. std::is_arithmetic<_A2>::value,
  1074. std::__promote<_A1, _A2>
  1075. >::type
  1076. hypot(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
  1077. {
  1078. typedef typename std::__promote<_A1, _A2>::type __result_type;
  1079. static_assert((!(std::_IsSame<_A1, __result_type>::value &&
  1080. std::_IsSame<_A2, __result_type>::value)), "");
  1081. return ::hypot((__result_type)__lcpp_x, (__result_type)__lcpp_y);
  1082. }
  1083. // ilogb
  1084. inline _LIBCPP_INLINE_VISIBILITY int ilogb(float __lcpp_x) _NOEXCEPT {return ::ilogbf(__lcpp_x);}
  1085. inline _LIBCPP_INLINE_VISIBILITY int ilogb(long double __lcpp_x) _NOEXCEPT {return ::ilogbl(__lcpp_x);}
  1086. template <class _A1>
  1087. inline _LIBCPP_INLINE_VISIBILITY
  1088. typename std::enable_if<std::is_integral<_A1>::value, int>::type
  1089. ilogb(_A1 __lcpp_x) _NOEXCEPT {return ::ilogb((double)__lcpp_x);}
  1090. // lgamma
  1091. inline _LIBCPP_INLINE_VISIBILITY float lgamma(float __lcpp_x) _NOEXCEPT {return ::lgammaf(__lcpp_x);}
  1092. inline _LIBCPP_INLINE_VISIBILITY long double lgamma(long double __lcpp_x) _NOEXCEPT {return ::lgammal(__lcpp_x);}
  1093. template <class _A1>
  1094. inline _LIBCPP_INLINE_VISIBILITY
  1095. typename std::enable_if<std::is_integral<_A1>::value, double>::type
  1096. lgamma(_A1 __lcpp_x) _NOEXCEPT {return ::lgamma((double)__lcpp_x);}
  1097. // llrint
  1098. inline _LIBCPP_INLINE_VISIBILITY long long llrint(float __lcpp_x) _NOEXCEPT
  1099. {
  1100. #if __has_builtin(__builtin_llrintf)
  1101. return __builtin_llrintf(__lcpp_x);
  1102. #else
  1103. return ::llrintf(__lcpp_x);
  1104. #endif
  1105. }
  1106. inline _LIBCPP_INLINE_VISIBILITY long long llrint(long double __lcpp_x) _NOEXCEPT
  1107. {
  1108. #if __has_builtin(__builtin_llrintl)
  1109. return __builtin_llrintl(__lcpp_x);
  1110. #else
  1111. return ::llrintl(__lcpp_x);
  1112. #endif
  1113. }
  1114. template <class _A1>
  1115. inline _LIBCPP_INLINE_VISIBILITY
  1116. typename std::enable_if<std::is_integral<_A1>::value, long long>::type
  1117. llrint(_A1 __lcpp_x) _NOEXCEPT
  1118. {
  1119. #if __has_builtin(__builtin_llrint)
  1120. return __builtin_llrint((double)__lcpp_x);
  1121. #else
  1122. return ::llrint((double)__lcpp_x);
  1123. #endif
  1124. }
  1125. // llround
  1126. inline _LIBCPP_INLINE_VISIBILITY long long llround(float __lcpp_x) _NOEXCEPT
  1127. {
  1128. #if __has_builtin(__builtin_llroundf)
  1129. return __builtin_llroundf(__lcpp_x);
  1130. #else
  1131. return ::llroundf(__lcpp_x);
  1132. #endif
  1133. }
  1134. inline _LIBCPP_INLINE_VISIBILITY long long llround(long double __lcpp_x) _NOEXCEPT
  1135. {
  1136. #if __has_builtin(__builtin_llroundl)
  1137. return __builtin_llroundl(__lcpp_x);
  1138. #else
  1139. return ::llroundl(__lcpp_x);
  1140. #endif
  1141. }
  1142. template <class _A1>
  1143. inline _LIBCPP_INLINE_VISIBILITY
  1144. typename std::enable_if<std::is_integral<_A1>::value, long long>::type
  1145. llround(_A1 __lcpp_x) _NOEXCEPT
  1146. {
  1147. #if __has_builtin(__builtin_llround)
  1148. return __builtin_llround((double)__lcpp_x);
  1149. #else
  1150. return ::llround((double)__lcpp_x);
  1151. #endif
  1152. }
  1153. // log1p
  1154. inline _LIBCPP_INLINE_VISIBILITY float log1p(float __lcpp_x) _NOEXCEPT {return ::log1pf(__lcpp_x);}
  1155. inline _LIBCPP_INLINE_VISIBILITY long double log1p(long double __lcpp_x) _NOEXCEPT {return ::log1pl(__lcpp_x);}
  1156. template <class _A1>
  1157. inline _LIBCPP_INLINE_VISIBILITY
  1158. typename std::enable_if<std::is_integral<_A1>::value, double>::type
  1159. log1p(_A1 __lcpp_x) _NOEXCEPT {return ::log1p((double)__lcpp_x);}
  1160. // log2
  1161. inline _LIBCPP_INLINE_VISIBILITY float log2(float __lcpp_x) _NOEXCEPT {return ::log2f(__lcpp_x);}
  1162. inline _LIBCPP_INLINE_VISIBILITY long double log2(long double __lcpp_x) _NOEXCEPT {return ::log2l(__lcpp_x);}
  1163. template <class _A1>
  1164. inline _LIBCPP_INLINE_VISIBILITY
  1165. typename std::enable_if<std::is_integral<_A1>::value, double>::type
  1166. log2(_A1 __lcpp_x) _NOEXCEPT {return ::log2((double)__lcpp_x);}
  1167. // logb
  1168. inline _LIBCPP_INLINE_VISIBILITY float logb(float __lcpp_x) _NOEXCEPT {return ::logbf(__lcpp_x);}
  1169. inline _LIBCPP_INLINE_VISIBILITY long double logb(long double __lcpp_x) _NOEXCEPT {return ::logbl(__lcpp_x);}
  1170. template <class _A1>
  1171. inline _LIBCPP_INLINE_VISIBILITY
  1172. typename std::enable_if<std::is_integral<_A1>::value, double>::type
  1173. logb(_A1 __lcpp_x) _NOEXCEPT {return ::logb((double)__lcpp_x);}
  1174. // lrint
  1175. inline _LIBCPP_INLINE_VISIBILITY long lrint(float __lcpp_x) _NOEXCEPT
  1176. {
  1177. #if __has_builtin(__builtin_lrintf)
  1178. return __builtin_lrintf(__lcpp_x);
  1179. #else
  1180. return ::lrintf(__lcpp_x);
  1181. #endif
  1182. }
  1183. inline _LIBCPP_INLINE_VISIBILITY long lrint(long double __lcpp_x) _NOEXCEPT
  1184. {
  1185. #if __has_builtin(__builtin_lrintl)
  1186. return __builtin_lrintl(__lcpp_x);
  1187. #else
  1188. return ::lrintl(__lcpp_x);
  1189. #endif
  1190. }
  1191. template <class _A1>
  1192. inline _LIBCPP_INLINE_VISIBILITY
  1193. typename std::enable_if<std::is_integral<_A1>::value, long>::type
  1194. lrint(_A1 __lcpp_x) _NOEXCEPT
  1195. {
  1196. #if __has_builtin(__builtin_lrint)
  1197. return __builtin_lrint((double)__lcpp_x);
  1198. #else
  1199. return ::lrint((double)__lcpp_x);
  1200. #endif
  1201. }
  1202. // lround
  1203. inline _LIBCPP_INLINE_VISIBILITY long lround(float __lcpp_x) _NOEXCEPT
  1204. {
  1205. #if __has_builtin(__builtin_lroundf)
  1206. return __builtin_lroundf(__lcpp_x);
  1207. #else
  1208. return ::lroundf(__lcpp_x);
  1209. #endif
  1210. }
  1211. inline _LIBCPP_INLINE_VISIBILITY long lround(long double __lcpp_x) _NOEXCEPT
  1212. {
  1213. #if __has_builtin(__builtin_lroundl)
  1214. return __builtin_lroundl(__lcpp_x);
  1215. #else
  1216. return ::lroundl(__lcpp_x);
  1217. #endif
  1218. }
  1219. template <class _A1>
  1220. inline _LIBCPP_INLINE_VISIBILITY
  1221. typename std::enable_if<std::is_integral<_A1>::value, long>::type
  1222. lround(_A1 __lcpp_x) _NOEXCEPT
  1223. {
  1224. #if __has_builtin(__builtin_lround)
  1225. return __builtin_lround((double)__lcpp_x);
  1226. #else
  1227. return ::lround((double)__lcpp_x);
  1228. #endif
  1229. }
  1230. // nan
  1231. // nearbyint
  1232. inline _LIBCPP_INLINE_VISIBILITY float nearbyint(float __lcpp_x) _NOEXCEPT {return ::nearbyintf(__lcpp_x);}
  1233. inline _LIBCPP_INLINE_VISIBILITY long double nearbyint(long double __lcpp_x) _NOEXCEPT {return ::nearbyintl(__lcpp_x);}
  1234. template <class _A1>
  1235. inline _LIBCPP_INLINE_VISIBILITY
  1236. typename std::enable_if<std::is_integral<_A1>::value, double>::type
  1237. nearbyint(_A1 __lcpp_x) _NOEXCEPT {return ::nearbyint((double)__lcpp_x);}
  1238. // nextafter
  1239. inline _LIBCPP_INLINE_VISIBILITY float nextafter(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::nextafterf(__lcpp_x, __lcpp_y);}
  1240. inline _LIBCPP_INLINE_VISIBILITY long double nextafter(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nextafterl(__lcpp_x, __lcpp_y);}
  1241. template <class _A1, class _A2>
  1242. inline _LIBCPP_INLINE_VISIBILITY
  1243. typename std::__enable_if_t
  1244. <
  1245. std::is_arithmetic<_A1>::value &&
  1246. std::is_arithmetic<_A2>::value,
  1247. std::__promote<_A1, _A2>
  1248. >::type
  1249. nextafter(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
  1250. {
  1251. typedef typename std::__promote<_A1, _A2>::type __result_type;
  1252. static_assert((!(std::_IsSame<_A1, __result_type>::value &&
  1253. std::_IsSame<_A2, __result_type>::value)), "");
  1254. return ::nextafter((__result_type)__lcpp_x, (__result_type)__lcpp_y);
  1255. }
  1256. // nexttoward
  1257. inline _LIBCPP_INLINE_VISIBILITY float nexttoward(float __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nexttowardf(__lcpp_x, __lcpp_y);}
  1258. inline _LIBCPP_INLINE_VISIBILITY long double nexttoward(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nexttowardl(__lcpp_x, __lcpp_y);}
  1259. template <class _A1>
  1260. inline _LIBCPP_INLINE_VISIBILITY
  1261. typename std::enable_if<std::is_integral<_A1>::value, double>::type
  1262. nexttoward(_A1 __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nexttoward((double)__lcpp_x, __lcpp_y);}
  1263. // remainder
  1264. inline _LIBCPP_INLINE_VISIBILITY float remainder(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::remainderf(__lcpp_x, __lcpp_y);}
  1265. inline _LIBCPP_INLINE_VISIBILITY long double remainder(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::remainderl(__lcpp_x, __lcpp_y);}
  1266. template <class _A1, class _A2>
  1267. inline _LIBCPP_INLINE_VISIBILITY
  1268. typename std::__enable_if_t
  1269. <
  1270. std::is_arithmetic<_A1>::value &&
  1271. std::is_arithmetic<_A2>::value,
  1272. std::__promote<_A1, _A2>
  1273. >::type
  1274. remainder(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
  1275. {
  1276. typedef typename std::__promote<_A1, _A2>::type __result_type;
  1277. static_assert((!(std::_IsSame<_A1, __result_type>::value &&
  1278. std::_IsSame<_A2, __result_type>::value)), "");
  1279. return ::remainder((__result_type)__lcpp_x, (__result_type)__lcpp_y);
  1280. }
  1281. // remquo
  1282. inline _LIBCPP_INLINE_VISIBILITY float remquo(float __lcpp_x, float __lcpp_y, int* __lcpp_z) _NOEXCEPT {return ::remquof(__lcpp_x, __lcpp_y, __lcpp_z);}
  1283. inline _LIBCPP_INLINE_VISIBILITY long double remquo(long double __lcpp_x, long double __lcpp_y, int* __lcpp_z) _NOEXCEPT {return ::remquol(__lcpp_x, __lcpp_y, __lcpp_z);}
  1284. template <class _A1, class _A2>
  1285. inline _LIBCPP_INLINE_VISIBILITY
  1286. typename std::__enable_if_t
  1287. <
  1288. std::is_arithmetic<_A1>::value &&
  1289. std::is_arithmetic<_A2>::value,
  1290. std::__promote<_A1, _A2>
  1291. >::type
  1292. remquo(_A1 __lcpp_x, _A2 __lcpp_y, int* __lcpp_z) _NOEXCEPT
  1293. {
  1294. typedef typename std::__promote<_A1, _A2>::type __result_type;
  1295. static_assert((!(std::_IsSame<_A1, __result_type>::value &&
  1296. std::_IsSame<_A2, __result_type>::value)), "");
  1297. return ::remquo((__result_type)__lcpp_x, (__result_type)__lcpp_y, __lcpp_z);
  1298. }
  1299. // rint
  1300. inline _LIBCPP_INLINE_VISIBILITY float rint(float __lcpp_x) _NOEXCEPT
  1301. {
  1302. #if __has_builtin(__builtin_rintf)
  1303. return __builtin_rintf(__lcpp_x);
  1304. #else
  1305. return ::rintf(__lcpp_x);
  1306. #endif
  1307. }
  1308. inline _LIBCPP_INLINE_VISIBILITY long double rint(long double __lcpp_x) _NOEXCEPT
  1309. {
  1310. #if __has_builtin(__builtin_rintl)
  1311. return __builtin_rintl(__lcpp_x);
  1312. #else
  1313. return ::rintl(__lcpp_x);
  1314. #endif
  1315. }
  1316. template <class _A1>
  1317. inline _LIBCPP_INLINE_VISIBILITY
  1318. typename std::enable_if<std::is_integral<_A1>::value, double>::type
  1319. rint(_A1 __lcpp_x) _NOEXCEPT
  1320. {
  1321. #if __has_builtin(__builtin_rint)
  1322. return __builtin_rint((double)__lcpp_x);
  1323. #else
  1324. return ::rint((double)__lcpp_x);
  1325. #endif
  1326. }
  1327. // round
  1328. inline _LIBCPP_INLINE_VISIBILITY float round(float __lcpp_x) _NOEXCEPT
  1329. {
  1330. #if __has_builtin(__builtin_roundf)
  1331. return __builtin_roundf(__lcpp_x);
  1332. #else
  1333. return ::roundf(__lcpp_x);
  1334. #endif
  1335. }
  1336. inline _LIBCPP_INLINE_VISIBILITY long double round(long double __lcpp_x) _NOEXCEPT
  1337. {
  1338. #if __has_builtin(__builtin_roundl)
  1339. return __builtin_roundl(__lcpp_x);
  1340. #else
  1341. return ::roundl(__lcpp_x);
  1342. #endif
  1343. }
  1344. template <class _A1>
  1345. inline _LIBCPP_INLINE_VISIBILITY
  1346. typename std::enable_if<std::is_integral<_A1>::value, double>::type
  1347. round(_A1 __lcpp_x) _NOEXCEPT
  1348. {
  1349. #if __has_builtin(__builtin_round)
  1350. return __builtin_round((double)__lcpp_x);
  1351. #else
  1352. return ::round((double)__lcpp_x);
  1353. #endif
  1354. }
  1355. // scalbln
  1356. inline _LIBCPP_INLINE_VISIBILITY float scalbln(float __lcpp_x, long __lcpp_y) _NOEXCEPT {return ::scalblnf(__lcpp_x, __lcpp_y);}
  1357. inline _LIBCPP_INLINE_VISIBILITY long double scalbln(long double __lcpp_x, long __lcpp_y) _NOEXCEPT {return ::scalblnl(__lcpp_x, __lcpp_y);}
  1358. template <class _A1>
  1359. inline _LIBCPP_INLINE_VISIBILITY
  1360. typename std::enable_if<std::is_integral<_A1>::value, double>::type
  1361. scalbln(_A1 __lcpp_x, long __lcpp_y) _NOEXCEPT {return ::scalbln((double)__lcpp_x, __lcpp_y);}
  1362. // scalbn
  1363. inline _LIBCPP_INLINE_VISIBILITY float scalbn(float __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbnf(__lcpp_x, __lcpp_y);}
  1364. inline _LIBCPP_INLINE_VISIBILITY long double scalbn(long double __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbnl(__lcpp_x, __lcpp_y);}
  1365. template <class _A1>
  1366. inline _LIBCPP_INLINE_VISIBILITY
  1367. typename std::enable_if<std::is_integral<_A1>::value, double>::type
  1368. scalbn(_A1 __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbn((double)__lcpp_x, __lcpp_y);}
  1369. // tgamma
  1370. inline _LIBCPP_INLINE_VISIBILITY float tgamma(float __lcpp_x) _NOEXCEPT {return ::tgammaf(__lcpp_x);}
  1371. inline _LIBCPP_INLINE_VISIBILITY long double tgamma(long double __lcpp_x) _NOEXCEPT {return ::tgammal(__lcpp_x);}
  1372. template <class _A1>
  1373. inline _LIBCPP_INLINE_VISIBILITY
  1374. typename std::enable_if<std::is_integral<_A1>::value, double>::type
  1375. tgamma(_A1 __lcpp_x) _NOEXCEPT {return ::tgamma((double)__lcpp_x);}
  1376. // trunc
  1377. inline _LIBCPP_INLINE_VISIBILITY float trunc(float __lcpp_x) _NOEXCEPT
  1378. {
  1379. #if __has_builtin(__builtin_truncf)
  1380. return __builtin_truncf(__lcpp_x);
  1381. #else
  1382. return ::truncf(__lcpp_x);
  1383. #endif
  1384. }
  1385. inline _LIBCPP_INLINE_VISIBILITY long double trunc(long double __lcpp_x) _NOEXCEPT
  1386. {
  1387. #if __has_builtin(__builtin_truncl)
  1388. return __builtin_truncl(__lcpp_x);
  1389. #else
  1390. return ::truncl(__lcpp_x);
  1391. #endif
  1392. }
  1393. template <class _A1>
  1394. inline _LIBCPP_INLINE_VISIBILITY
  1395. typename std::enable_if<std::is_integral<_A1>::value, double>::type
  1396. trunc(_A1 __lcpp_x) _NOEXCEPT
  1397. {
  1398. #if __has_builtin(__builtin_trunc)
  1399. return __builtin_trunc((double)__lcpp_x);
  1400. #else
  1401. return ::trunc((double)__lcpp_x);
  1402. #endif
  1403. }
  1404. } // extern "C++"
  1405. #endif // __cplusplus
  1406. #else // _LIBCPP_MATH_H
  1407. // This include lives outside the header guard in order to support an MSVC
  1408. // extension which allows users to do:
  1409. //
  1410. // #define _USE_MATH_DEFINES
  1411. // #include <math.h>
  1412. //
  1413. // and receive the definitions of mathematical constants, even if <math.h>
  1414. // has previously been included.
  1415. #if defined(_LIBCPP_MSVCRT) && defined(_USE_MATH_DEFINES)
  1416. #ifdef _LIBCPP_COMPILER_MSVC
  1417. #include Y_UCRT_INCLUDE_NEXT(math.h)
  1418. #else
  1419. #include_next <math.h>
  1420. #endif
  1421. #endif
  1422. #endif // _LIBCPP_MATH_H