cmath 39 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517
  1. // TR1 cmath -*- C++ -*-
  2. // Copyright (C) 2006-2015 Free Software Foundation, Inc.
  3. //
  4. // This file is part of the GNU ISO C++ Library. This library is free
  5. // software; you can redistribute it and/or modify it under the
  6. // terms of the GNU General Public License as published by the
  7. // Free Software Foundation; either version 3, or (at your option)
  8. // any later version.
  9. // This library is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU General Public License for more details.
  13. // Under Section 7 of GPL version 3, you are granted additional
  14. // permissions described in the GCC Runtime Library Exception, version
  15. // 3.1, as published by the Free Software Foundation.
  16. // You should have received a copy of the GNU General Public License and
  17. // a copy of the GCC Runtime Library Exception along with this program;
  18. // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  19. // <http://www.gnu.org/licenses/>.
  20. /** @file tr1/cmath
  21. * This is a TR1 C++ Library header.
  22. */
  23. #ifndef _GLIBCXX_TR1_CMATH
  24. #define _GLIBCXX_TR1_CMATH 1
  25. #pragma GCC system_header
  26. #include <cmath>
  27. #ifdef _GLIBCXX_USE_C99_MATH_TR1
  28. #undef acosh
  29. #undef acoshf
  30. #undef acoshl
  31. #undef asinh
  32. #undef asinhf
  33. #undef asinhl
  34. #undef atanh
  35. #undef atanhf
  36. #undef atanhl
  37. #undef cbrt
  38. #undef cbrtf
  39. #undef cbrtl
  40. #undef copysign
  41. #undef copysignf
  42. #undef copysignl
  43. #undef erf
  44. #undef erff
  45. #undef erfl
  46. #undef erfc
  47. #undef erfcf
  48. #undef erfcl
  49. #undef exp2
  50. #undef exp2f
  51. #undef exp2l
  52. #undef expm1
  53. #undef expm1f
  54. #undef expm1l
  55. #undef fdim
  56. #undef fdimf
  57. #undef fdiml
  58. #undef fma
  59. #undef fmaf
  60. #undef fmal
  61. #undef fmax
  62. #undef fmaxf
  63. #undef fmaxl
  64. #undef fmin
  65. #undef fminf
  66. #undef fminl
  67. #undef hypot
  68. #undef hypotf
  69. #undef hypotl
  70. #undef ilogb
  71. #undef ilogbf
  72. #undef ilogbl
  73. #undef lgamma
  74. #undef lgammaf
  75. #undef lgammal
  76. #undef llrint
  77. #undef llrintf
  78. #undef llrintl
  79. #undef llround
  80. #undef llroundf
  81. #undef llroundl
  82. #undef log1p
  83. #undef log1pf
  84. #undef log1pl
  85. #undef log2
  86. #undef log2f
  87. #undef log2l
  88. #undef logb
  89. #undef logbf
  90. #undef logbl
  91. #undef lrint
  92. #undef lrintf
  93. #undef lrintl
  94. #undef lround
  95. #undef lroundf
  96. #undef lroundl
  97. #undef nan
  98. #undef nanf
  99. #undef nanl
  100. #undef nearbyint
  101. #undef nearbyintf
  102. #undef nearbyintl
  103. #undef nextafter
  104. #undef nextafterf
  105. #undef nextafterl
  106. #undef nexttoward
  107. #undef nexttowardf
  108. #undef nexttowardl
  109. #undef remainder
  110. #undef remainderf
  111. #undef remainderl
  112. #undef remquo
  113. #undef remquof
  114. #undef remquol
  115. #undef rint
  116. #undef rintf
  117. #undef rintl
  118. #undef round
  119. #undef roundf
  120. #undef roundl
  121. #undef scalbln
  122. #undef scalblnf
  123. #undef scalblnl
  124. #undef scalbn
  125. #undef scalbnf
  126. #undef scalbnl
  127. #undef tgamma
  128. #undef tgammaf
  129. #undef tgammal
  130. #undef trunc
  131. #undef truncf
  132. #undef truncl
  133. #endif
  134. namespace std _GLIBCXX_VISIBILITY(default)
  135. {
  136. namespace tr1
  137. {
  138. _GLIBCXX_BEGIN_NAMESPACE_VERSION
  139. #if _GLIBCXX_USE_C99_MATH_TR1
  140. // types
  141. using ::double_t;
  142. using ::float_t;
  143. // functions
  144. using ::acosh;
  145. using ::acoshf;
  146. using ::acoshl;
  147. using ::asinh;
  148. using ::asinhf;
  149. using ::asinhl;
  150. using ::atanh;
  151. using ::atanhf;
  152. using ::atanhl;
  153. using ::cbrt;
  154. using ::cbrtf;
  155. using ::cbrtl;
  156. using ::copysign;
  157. using ::copysignf;
  158. using ::copysignl;
  159. using ::erf;
  160. using ::erff;
  161. using ::erfl;
  162. using ::erfc;
  163. using ::erfcf;
  164. using ::erfcl;
  165. using ::exp2;
  166. using ::exp2f;
  167. using ::exp2l;
  168. using ::expm1;
  169. using ::expm1f;
  170. using ::expm1l;
  171. using ::fdim;
  172. using ::fdimf;
  173. using ::fdiml;
  174. using ::fma;
  175. using ::fmaf;
  176. using ::fmal;
  177. using ::fmax;
  178. using ::fmaxf;
  179. using ::fmaxl;
  180. using ::fmin;
  181. using ::fminf;
  182. using ::fminl;
  183. using ::hypot;
  184. using ::hypotf;
  185. using ::hypotl;
  186. using ::ilogb;
  187. using ::ilogbf;
  188. using ::ilogbl;
  189. using ::lgamma;
  190. using ::lgammaf;
  191. using ::lgammal;
  192. using ::llrint;
  193. using ::llrintf;
  194. using ::llrintl;
  195. using ::llround;
  196. using ::llroundf;
  197. using ::llroundl;
  198. using ::log1p;
  199. using ::log1pf;
  200. using ::log1pl;
  201. using ::log2;
  202. using ::log2f;
  203. using ::log2l;
  204. using ::logb;
  205. using ::logbf;
  206. using ::logbl;
  207. using ::lrint;
  208. using ::lrintf;
  209. using ::lrintl;
  210. using ::lround;
  211. using ::lroundf;
  212. using ::lroundl;
  213. using ::nan;
  214. using ::nanf;
  215. using ::nanl;
  216. using ::nearbyint;
  217. using ::nearbyintf;
  218. using ::nearbyintl;
  219. using ::nextafter;
  220. using ::nextafterf;
  221. using ::nextafterl;
  222. using ::nexttoward;
  223. using ::nexttowardf;
  224. using ::nexttowardl;
  225. using ::remainder;
  226. using ::remainderf;
  227. using ::remainderl;
  228. using ::remquo;
  229. using ::remquof;
  230. using ::remquol;
  231. using ::rint;
  232. using ::rintf;
  233. using ::rintl;
  234. using ::round;
  235. using ::roundf;
  236. using ::roundl;
  237. using ::scalbln;
  238. using ::scalblnf;
  239. using ::scalblnl;
  240. using ::scalbn;
  241. using ::scalbnf;
  242. using ::scalbnl;
  243. using ::tgamma;
  244. using ::tgammaf;
  245. using ::tgammal;
  246. using ::trunc;
  247. using ::truncf;
  248. using ::truncl;
  249. #endif
  250. #if _GLIBCXX_USE_C99_MATH
  251. #if !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC
  252. /// Function template definitions [8.16.3].
  253. template<typename _Tp>
  254. inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
  255. int>::__type
  256. fpclassify(_Tp __f)
  257. {
  258. typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
  259. return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
  260. FP_SUBNORMAL, FP_ZERO, __type(__f));
  261. }
  262. template<typename _Tp>
  263. inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
  264. int>::__type
  265. isfinite(_Tp __f)
  266. {
  267. typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
  268. return __builtin_isfinite(__type(__f));
  269. }
  270. template<typename _Tp>
  271. inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
  272. int>::__type
  273. isinf(_Tp __f)
  274. {
  275. typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
  276. return __builtin_isinf(__type(__f));
  277. }
  278. template<typename _Tp>
  279. inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
  280. int>::__type
  281. isnan(_Tp __f)
  282. {
  283. typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
  284. return __builtin_isnan(__type(__f));
  285. }
  286. template<typename _Tp>
  287. inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
  288. int>::__type
  289. isnormal(_Tp __f)
  290. {
  291. typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
  292. return __builtin_isnormal(__type(__f));
  293. }
  294. template<typename _Tp>
  295. inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
  296. int>::__type
  297. signbit(_Tp __f)
  298. {
  299. typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
  300. return __builtin_signbit(__type(__f));
  301. }
  302. template<typename _Tp>
  303. inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
  304. int>::__type
  305. isgreater(_Tp __f1, _Tp __f2)
  306. {
  307. typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
  308. return __builtin_isgreater(__type(__f1), __type(__f2));
  309. }
  310. template<typename _Tp>
  311. inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
  312. int>::__type
  313. isgreaterequal(_Tp __f1, _Tp __f2)
  314. {
  315. typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
  316. return __builtin_isgreaterequal(__type(__f1), __type(__f2));
  317. }
  318. template<typename _Tp>
  319. inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
  320. int>::__type
  321. isless(_Tp __f1, _Tp __f2)
  322. {
  323. typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
  324. return __builtin_isless(__type(__f1), __type(__f2));
  325. }
  326. template<typename _Tp>
  327. inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
  328. int>::__type
  329. islessequal(_Tp __f1, _Tp __f2)
  330. {
  331. typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
  332. return __builtin_islessequal(__type(__f1), __type(__f2));
  333. }
  334. template<typename _Tp>
  335. inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
  336. int>::__type
  337. islessgreater(_Tp __f1, _Tp __f2)
  338. {
  339. typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
  340. return __builtin_islessgreater(__type(__f1), __type(__f2));
  341. }
  342. template<typename _Tp>
  343. inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
  344. int>::__type
  345. isunordered(_Tp __f1, _Tp __f2)
  346. {
  347. typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
  348. return __builtin_isunordered(__type(__f1), __type(__f2));
  349. }
  350. #endif
  351. #endif
  352. #if _GLIBCXX_USE_C99_MATH_TR1
  353. /// Additional overloads [8.16.4].
  354. using std::acos;
  355. #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
  356. inline float
  357. acosh(float __x)
  358. { return __builtin_acoshf(__x); }
  359. inline long double
  360. acosh(long double __x)
  361. { return __builtin_acoshl(__x); }
  362. #endif
  363. template<typename _Tp>
  364. inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
  365. double>::__type
  366. acosh(_Tp __x)
  367. { return __builtin_acosh(__x); }
  368. using std::asin;
  369. #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
  370. inline float
  371. asinh(float __x)
  372. { return __builtin_asinhf(__x); }
  373. inline long double
  374. asinh(long double __x)
  375. { return __builtin_asinhl(__x); }
  376. #endif
  377. template<typename _Tp>
  378. inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
  379. double>::__type
  380. asinh(_Tp __x)
  381. { return __builtin_asinh(__x); }
  382. using std::atan;
  383. using std::atan2;
  384. #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
  385. inline float
  386. atanh(float __x)
  387. { return __builtin_atanhf(__x); }
  388. inline long double
  389. atanh(long double __x)
  390. { return __builtin_atanhl(__x); }
  391. #endif
  392. template<typename _Tp>
  393. inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
  394. double>::__type
  395. atanh(_Tp __x)
  396. { return __builtin_atanh(__x); }
  397. #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
  398. inline float
  399. cbrt(float __x)
  400. { return __builtin_cbrtf(__x); }
  401. inline long double
  402. cbrt(long double __x)
  403. { return __builtin_cbrtl(__x); }
  404. #endif
  405. template<typename _Tp>
  406. inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
  407. double>::__type
  408. cbrt(_Tp __x)
  409. { return __builtin_cbrt(__x); }
  410. using std::ceil;
  411. #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
  412. inline float
  413. copysign(float __x, float __y)
  414. { return __builtin_copysignf(__x, __y); }
  415. inline long double
  416. copysign(long double __x, long double __y)
  417. { return __builtin_copysignl(__x, __y); }
  418. #endif
  419. template<typename _Tp, typename _Up>
  420. inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
  421. copysign(_Tp __x, _Up __y)
  422. {
  423. typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
  424. return copysign(__type(__x), __type(__y));
  425. }
  426. using std::cos;
  427. using std::cosh;
  428. #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
  429. inline float
  430. erf(float __x)
  431. { return __builtin_erff(__x); }
  432. inline long double
  433. erf(long double __x)
  434. { return __builtin_erfl(__x); }
  435. #endif
  436. template<typename _Tp>
  437. inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
  438. double>::__type
  439. erf(_Tp __x)
  440. { return __builtin_erf(__x); }
  441. #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
  442. inline float
  443. erfc(float __x)
  444. { return __builtin_erfcf(__x); }
  445. inline long double
  446. erfc(long double __x)
  447. { return __builtin_erfcl(__x); }
  448. #endif
  449. template<typename _Tp>
  450. inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
  451. double>::__type
  452. erfc(_Tp __x)
  453. { return __builtin_erfc(__x); }
  454. using std::exp;
  455. #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
  456. inline float
  457. exp2(float __x)
  458. { return __builtin_exp2f(__x); }
  459. inline long double
  460. exp2(long double __x)
  461. { return __builtin_exp2l(__x); }
  462. #endif
  463. template<typename _Tp>
  464. inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
  465. double>::__type
  466. exp2(_Tp __x)
  467. { return __builtin_exp2(__x); }
  468. #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
  469. inline float
  470. expm1(float __x)
  471. { return __builtin_expm1f(__x); }
  472. inline long double
  473. expm1(long double __x)
  474. { return __builtin_expm1l(__x); }
  475. #endif
  476. template<typename _Tp>
  477. inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
  478. double>::__type
  479. expm1(_Tp __x)
  480. { return __builtin_expm1(__x); }
  481. // Note: we deal with fabs in a special way, because an using std::fabs
  482. // would bring in also the overloads for complex types, which in C++0x
  483. // mode have a different return type.
  484. // With __CORRECT_ISO_CPP_MATH_H_PROTO, math.h imports std::fabs in the
  485. // global namespace after the declarations of the float / double / long
  486. // double overloads but before the std::complex overloads.
  487. using ::fabs;
  488. #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
  489. #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
  490. inline float
  491. fabs(float __x)
  492. { return __builtin_fabsf(__x); }
  493. inline long double
  494. fabs(long double __x)
  495. { return __builtin_fabsl(__x); }
  496. #endif
  497. template<typename _Tp>
  498. inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
  499. double>::__type
  500. fabs(_Tp __x)
  501. { return __builtin_fabs(__x); }
  502. #endif
  503. #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
  504. inline float
  505. fdim(float __x, float __y)
  506. { return __builtin_fdimf(__x, __y); }
  507. inline long double
  508. fdim(long double __x, long double __y)
  509. { return __builtin_fdiml(__x, __y); }
  510. #endif
  511. template<typename _Tp, typename _Up>
  512. inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
  513. fdim(_Tp __x, _Up __y)
  514. {
  515. typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
  516. return fdim(__type(__x), __type(__y));
  517. }
  518. using std::floor;
  519. #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
  520. inline float
  521. fma(float __x, float __y, float __z)
  522. { return __builtin_fmaf(__x, __y, __z); }
  523. inline long double
  524. fma(long double __x, long double __y, long double __z)
  525. { return __builtin_fmal(__x, __y, __z); }
  526. #endif
  527. template<typename _Tp, typename _Up, typename _Vp>
  528. inline typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type
  529. fma(_Tp __x, _Up __y, _Vp __z)
  530. {
  531. typedef typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type __type;
  532. return fma(__type(__x), __type(__y), __type(__z));
  533. }
  534. #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
  535. inline float
  536. fmax(float __x, float __y)
  537. { return __builtin_fmaxf(__x, __y); }
  538. inline long double
  539. fmax(long double __x, long double __y)
  540. { return __builtin_fmaxl(__x, __y); }
  541. #endif
  542. template<typename _Tp, typename _Up>
  543. inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
  544. fmax(_Tp __x, _Up __y)
  545. {
  546. typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
  547. return fmax(__type(__x), __type(__y));
  548. }
  549. #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
  550. inline float
  551. fmin(float __x, float __y)
  552. { return __builtin_fminf(__x, __y); }
  553. inline long double
  554. fmin(long double __x, long double __y)
  555. { return __builtin_fminl(__x, __y); }
  556. #endif
  557. template<typename _Tp, typename _Up>
  558. inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
  559. fmin(_Tp __x, _Up __y)
  560. {
  561. typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
  562. return fmin(__type(__x), __type(__y));
  563. }
  564. using std::fmod;
  565. using std::frexp;
  566. #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
  567. inline float
  568. hypot(float __x, float __y)
  569. { return __builtin_hypotf(__x, __y); }
  570. inline long double
  571. hypot(long double __x, long double __y)
  572. { return __builtin_hypotl(__x, __y); }
  573. #endif
  574. template<typename _Tp, typename _Up>
  575. inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
  576. hypot(_Tp __y, _Up __x)
  577. {
  578. typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
  579. return hypot(__type(__y), __type(__x));
  580. }
  581. #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
  582. inline int
  583. ilogb(float __x)
  584. { return __builtin_ilogbf(__x); }
  585. inline int
  586. ilogb(long double __x)
  587. { return __builtin_ilogbl(__x); }
  588. #endif
  589. template<typename _Tp>
  590. inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
  591. int>::__type
  592. ilogb(_Tp __x)
  593. { return __builtin_ilogb(__x); }
  594. using std::ldexp;
  595. #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
  596. inline float
  597. lgamma(float __x)
  598. { return __builtin_lgammaf(__x); }
  599. inline long double
  600. lgamma(long double __x)
  601. { return __builtin_lgammal(__x); }
  602. #endif
  603. template<typename _Tp>
  604. inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
  605. double>::__type
  606. lgamma(_Tp __x)
  607. { return __builtin_lgamma(__x); }
  608. #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
  609. inline long long
  610. llrint(float __x)
  611. { return __builtin_llrintf(__x); }
  612. inline long long
  613. llrint(long double __x)
  614. { return __builtin_llrintl(__x); }
  615. #endif
  616. template<typename _Tp>
  617. inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
  618. long long>::__type
  619. llrint(_Tp __x)
  620. { return __builtin_llrint(__x); }
  621. #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
  622. inline long long
  623. llround(float __x)
  624. { return __builtin_llroundf(__x); }
  625. inline long long
  626. llround(long double __x)
  627. { return __builtin_llroundl(__x); }
  628. #endif
  629. template<typename _Tp>
  630. inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
  631. long long>::__type
  632. llround(_Tp __x)
  633. { return __builtin_llround(__x); }
  634. using std::log;
  635. using std::log10;
  636. #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
  637. inline float
  638. log1p(float __x)
  639. { return __builtin_log1pf(__x); }
  640. inline long double
  641. log1p(long double __x)
  642. { return __builtin_log1pl(__x); }
  643. #endif
  644. template<typename _Tp>
  645. inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
  646. double>::__type
  647. log1p(_Tp __x)
  648. { return __builtin_log1p(__x); }
  649. // DR 568.
  650. #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
  651. inline float
  652. log2(float __x)
  653. { return __builtin_log2f(__x); }
  654. inline long double
  655. log2(long double __x)
  656. { return __builtin_log2l(__x); }
  657. #endif
  658. template<typename _Tp>
  659. inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
  660. double>::__type
  661. log2(_Tp __x)
  662. { return __builtin_log2(__x); }
  663. #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
  664. inline float
  665. logb(float __x)
  666. { return __builtin_logbf(__x); }
  667. inline long double
  668. logb(long double __x)
  669. { return __builtin_logbl(__x); }
  670. #endif
  671. template<typename _Tp>
  672. inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
  673. double>::__type
  674. logb(_Tp __x)
  675. {
  676. return __builtin_logb(__x);
  677. }
  678. #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
  679. inline long
  680. lrint(float __x)
  681. { return __builtin_lrintf(__x); }
  682. inline long
  683. lrint(long double __x)
  684. { return __builtin_lrintl(__x); }
  685. #endif
  686. template<typename _Tp>
  687. inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
  688. long>::__type
  689. lrint(_Tp __x)
  690. { return __builtin_lrint(__x); }
  691. #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
  692. inline long
  693. lround(float __x)
  694. { return __builtin_lroundf(__x); }
  695. inline long
  696. lround(long double __x)
  697. { return __builtin_lroundl(__x); }
  698. #endif
  699. template<typename _Tp>
  700. inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
  701. long>::__type
  702. lround(_Tp __x)
  703. { return __builtin_lround(__x); }
  704. #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
  705. inline float
  706. nearbyint(float __x)
  707. { return __builtin_nearbyintf(__x); }
  708. inline long double
  709. nearbyint(long double __x)
  710. { return __builtin_nearbyintl(__x); }
  711. #endif
  712. template<typename _Tp>
  713. inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
  714. double>::__type
  715. nearbyint(_Tp __x)
  716. { return __builtin_nearbyint(__x); }
  717. #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
  718. inline float
  719. nextafter(float __x, float __y)
  720. { return __builtin_nextafterf(__x, __y); }
  721. inline long double
  722. nextafter(long double __x, long double __y)
  723. { return __builtin_nextafterl(__x, __y); }
  724. #endif
  725. template<typename _Tp, typename _Up>
  726. inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
  727. nextafter(_Tp __x, _Up __y)
  728. {
  729. typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
  730. return nextafter(__type(__x), __type(__y));
  731. }
  732. #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
  733. inline float
  734. nexttoward(float __x, long double __y)
  735. { return __builtin_nexttowardf(__x, __y); }
  736. inline long double
  737. nexttoward(long double __x, long double __y)
  738. { return __builtin_nexttowardl(__x, __y); }
  739. #endif
  740. template<typename _Tp>
  741. inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
  742. double>::__type
  743. nexttoward(_Tp __x, long double __y)
  744. { return __builtin_nexttoward(__x, __y); }
  745. #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
  746. inline float
  747. remainder(float __x, float __y)
  748. { return __builtin_remainderf(__x, __y); }
  749. inline long double
  750. remainder(long double __x, long double __y)
  751. { return __builtin_remainderl(__x, __y); }
  752. #endif
  753. template<typename _Tp, typename _Up>
  754. inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
  755. remainder(_Tp __x, _Up __y)
  756. {
  757. typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
  758. return remainder(__type(__x), __type(__y));
  759. }
  760. #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
  761. inline float
  762. remquo(float __x, float __y, int* __pquo)
  763. { return __builtin_remquof(__x, __y, __pquo); }
  764. inline long double
  765. remquo(long double __x, long double __y, int* __pquo)
  766. { return __builtin_remquol(__x, __y, __pquo); }
  767. #endif
  768. template<typename _Tp, typename _Up>
  769. inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
  770. remquo(_Tp __x, _Up __y, int* __pquo)
  771. {
  772. typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
  773. return remquo(__type(__x), __type(__y), __pquo);
  774. }
  775. #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
  776. inline float
  777. rint(float __x)
  778. { return __builtin_rintf(__x); }
  779. inline long double
  780. rint(long double __x)
  781. { return __builtin_rintl(__x); }
  782. #endif
  783. template<typename _Tp>
  784. inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
  785. double>::__type
  786. rint(_Tp __x)
  787. { return __builtin_rint(__x); }
  788. #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
  789. inline float
  790. round(float __x)
  791. { return __builtin_roundf(__x); }
  792. inline long double
  793. round(long double __x)
  794. { return __builtin_roundl(__x); }
  795. #endif
  796. template<typename _Tp>
  797. inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
  798. double>::__type
  799. round(_Tp __x)
  800. { return __builtin_round(__x); }
  801. #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
  802. inline float
  803. scalbln(float __x, long __ex)
  804. { return __builtin_scalblnf(__x, __ex); }
  805. inline long double
  806. scalbln(long double __x, long __ex)
  807. { return __builtin_scalblnl(__x, __ex); }
  808. #endif
  809. template<typename _Tp>
  810. inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
  811. double>::__type
  812. scalbln(_Tp __x, long __ex)
  813. { return __builtin_scalbln(__x, __ex); }
  814. #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
  815. inline float
  816. scalbn(float __x, int __ex)
  817. { return __builtin_scalbnf(__x, __ex); }
  818. inline long double
  819. scalbn(long double __x, int __ex)
  820. { return __builtin_scalbnl(__x, __ex); }
  821. #endif
  822. template<typename _Tp>
  823. inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
  824. double>::__type
  825. scalbn(_Tp __x, int __ex)
  826. { return __builtin_scalbn(__x, __ex); }
  827. using std::sin;
  828. using std::sinh;
  829. using std::sqrt;
  830. using std::tan;
  831. using std::tanh;
  832. #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
  833. inline float
  834. tgamma(float __x)
  835. { return __builtin_tgammaf(__x); }
  836. inline long double
  837. tgamma(long double __x)
  838. { return __builtin_tgammal(__x); }
  839. #endif
  840. template<typename _Tp>
  841. inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
  842. double>::__type
  843. tgamma(_Tp __x)
  844. { return __builtin_tgamma(__x); }
  845. #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
  846. inline float
  847. trunc(float __x)
  848. { return __builtin_truncf(__x); }
  849. inline long double
  850. trunc(long double __x)
  851. { return __builtin_truncl(__x); }
  852. #endif
  853. template<typename _Tp>
  854. inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
  855. double>::__type
  856. trunc(_Tp __x)
  857. { return __builtin_trunc(__x); }
  858. #endif
  859. _GLIBCXX_END_NAMESPACE_VERSION
  860. }
  861. }
  862. namespace std _GLIBCXX_VISIBILITY(default)
  863. {
  864. namespace tr1
  865. {
  866. _GLIBCXX_BEGIN_NAMESPACE_VERSION
  867. // DR 550. What should the return type of pow(float,int) be?
  868. // NB: C++0x and TR1 != C++03.
  869. // The std::tr1::pow(double, double) overload cannot be provided
  870. // here, because it would clash with ::pow(double,double) declared
  871. // in <math.h>, if <tr1/math.h> is included at the same time (raised
  872. // by the fix of PR c++/54537). It is not possible either to use the
  873. // using-declaration 'using ::pow;' here, because if the user code
  874. // has a 'using std::pow;', it would bring the pow(*,int) averloads
  875. // in the tr1 namespace, which is undesirable. Consequently, the
  876. // solution is to forward std::tr1::pow(double,double) to
  877. // std::pow(double,double) via the templatized version below. See
  878. // the discussion about this issue here:
  879. // http://gcc.gnu.org/ml/gcc-patches/2012-09/msg01278.html
  880. #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
  881. inline float
  882. pow(float __x, float __y)
  883. { return std::pow(__x, __y); }
  884. inline long double
  885. pow(long double __x, long double __y)
  886. { return std::pow(__x, __y); }
  887. #endif
  888. template<typename _Tp, typename _Up>
  889. inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
  890. pow(_Tp __x, _Up __y)
  891. {
  892. typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
  893. return std::pow(__type(__x), __type(__y));
  894. }
  895. _GLIBCXX_END_NAMESPACE_VERSION
  896. }
  897. }
  898. #include <bits/stl_algobase.h>
  899. #include <limits>
  900. #include <tr1/type_traits>
  901. #include <tr1/gamma.tcc>
  902. #include <tr1/bessel_function.tcc>
  903. #include <tr1/beta_function.tcc>
  904. #include <tr1/ell_integral.tcc>
  905. #include <tr1/exp_integral.tcc>
  906. #include <tr1/hypergeometric.tcc>
  907. #include <tr1/legendre_function.tcc>
  908. #include <tr1/modified_bessel_func.tcc>
  909. #include <tr1/poly_hermite.tcc>
  910. #include <tr1/poly_laguerre.tcc>
  911. #include <tr1/riemann_zeta.tcc>
  912. namespace std _GLIBCXX_VISIBILITY(default)
  913. {
  914. namespace tr1
  915. {
  916. _GLIBCXX_BEGIN_NAMESPACE_VERSION
  917. /**
  918. * @defgroup tr1_math_spec_func Mathematical Special Functions
  919. * @ingroup numerics
  920. *
  921. * A collection of advanced mathematical special functions.
  922. * @{
  923. */
  924. inline float
  925. assoc_laguerref(unsigned int __n, unsigned int __m, float __x)
  926. { return __detail::__assoc_laguerre<float>(__n, __m, __x); }
  927. inline long double
  928. assoc_laguerrel(unsigned int __n, unsigned int __m, long double __x)
  929. {
  930. return __detail::__assoc_laguerre<long double>(__n, __m, __x);
  931. }
  932. /// 5.2.1.1 Associated Laguerre polynomials.
  933. template<typename _Tp>
  934. inline typename __gnu_cxx::__promote<_Tp>::__type
  935. assoc_laguerre(unsigned int __n, unsigned int __m, _Tp __x)
  936. {
  937. typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
  938. return __detail::__assoc_laguerre<__type>(__n, __m, __x);
  939. }
  940. inline float
  941. assoc_legendref(unsigned int __l, unsigned int __m, float __x)
  942. { return __detail::__assoc_legendre_p<float>(__l, __m, __x); }
  943. inline long double
  944. assoc_legendrel(unsigned int __l, unsigned int __m, long double __x)
  945. { return __detail::__assoc_legendre_p<long double>(__l, __m, __x); }
  946. /// 5.2.1.2 Associated Legendre functions.
  947. template<typename _Tp>
  948. inline typename __gnu_cxx::__promote<_Tp>::__type
  949. assoc_legendre(unsigned int __l, unsigned int __m, _Tp __x)
  950. {
  951. typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
  952. return __detail::__assoc_legendre_p<__type>(__l, __m, __x);
  953. }
  954. inline float
  955. betaf(float __x, float __y)
  956. { return __detail::__beta<float>(__x, __y); }
  957. inline long double
  958. betal(long double __x, long double __y)
  959. { return __detail::__beta<long double>(__x, __y); }
  960. /// 5.2.1.3 Beta functions.
  961. template<typename _Tpx, typename _Tpy>
  962. inline typename __gnu_cxx::__promote_2<_Tpx, _Tpy>::__type
  963. beta(_Tpx __x, _Tpy __y)
  964. {
  965. typedef typename __gnu_cxx::__promote_2<_Tpx, _Tpy>::__type __type;
  966. return __detail::__beta<__type>(__x, __y);
  967. }
  968. inline float
  969. comp_ellint_1f(float __k)
  970. { return __detail::__comp_ellint_1<float>(__k); }
  971. inline long double
  972. comp_ellint_1l(long double __k)
  973. { return __detail::__comp_ellint_1<long double>(__k); }
  974. /// 5.2.1.4 Complete elliptic integrals of the first kind.
  975. template<typename _Tp>
  976. inline typename __gnu_cxx::__promote<_Tp>::__type
  977. comp_ellint_1(_Tp __k)
  978. {
  979. typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
  980. return __detail::__comp_ellint_1<__type>(__k);
  981. }
  982. inline float
  983. comp_ellint_2f(float __k)
  984. { return __detail::__comp_ellint_2<float>(__k); }
  985. inline long double
  986. comp_ellint_2l(long double __k)
  987. { return __detail::__comp_ellint_2<long double>(__k); }
  988. /// 5.2.1.5 Complete elliptic integrals of the second kind.
  989. template<typename _Tp>
  990. inline typename __gnu_cxx::__promote<_Tp>::__type
  991. comp_ellint_2(_Tp __k)
  992. {
  993. typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
  994. return __detail::__comp_ellint_2<__type>(__k);
  995. }
  996. inline float
  997. comp_ellint_3f(float __k, float __nu)
  998. { return __detail::__comp_ellint_3<float>(__k, __nu); }
  999. inline long double
  1000. comp_ellint_3l(long double __k, long double __nu)
  1001. { return __detail::__comp_ellint_3<long double>(__k, __nu); }
  1002. /// 5.2.1.6 Complete elliptic integrals of the third kind.
  1003. template<typename _Tp, typename _Tpn>
  1004. inline typename __gnu_cxx::__promote_2<_Tp, _Tpn>::__type
  1005. comp_ellint_3(_Tp __k, _Tpn __nu)
  1006. {
  1007. typedef typename __gnu_cxx::__promote_2<_Tp, _Tpn>::__type __type;
  1008. return __detail::__comp_ellint_3<__type>(__k, __nu);
  1009. }
  1010. inline float
  1011. conf_hypergf(float __a, float __c, float __x)
  1012. { return __detail::__conf_hyperg<float>(__a, __c, __x); }
  1013. inline long double
  1014. conf_hypergl(long double __a, long double __c, long double __x)
  1015. { return __detail::__conf_hyperg<long double>(__a, __c, __x); }
  1016. /// 5.2.1.7 Confluent hypergeometric functions.
  1017. template<typename _Tpa, typename _Tpc, typename _Tp>
  1018. inline typename __gnu_cxx::__promote_3<_Tpa, _Tpc, _Tp>::__type
  1019. conf_hyperg(_Tpa __a, _Tpc __c, _Tp __x)
  1020. {
  1021. typedef typename __gnu_cxx::__promote_3<_Tpa, _Tpc, _Tp>::__type __type;
  1022. return __detail::__conf_hyperg<__type>(__a, __c, __x);
  1023. }
  1024. inline float
  1025. cyl_bessel_if(float __nu, float __x)
  1026. { return __detail::__cyl_bessel_i<float>(__nu, __x); }
  1027. inline long double
  1028. cyl_bessel_il(long double __nu, long double __x)
  1029. { return __detail::__cyl_bessel_i<long double>(__nu, __x); }
  1030. /// 5.2.1.8 Regular modified cylindrical Bessel functions.
  1031. template<typename _Tpnu, typename _Tp>
  1032. inline typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type
  1033. cyl_bessel_i(_Tpnu __nu, _Tp __x)
  1034. {
  1035. typedef typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type __type;
  1036. return __detail::__cyl_bessel_i<__type>(__nu, __x);
  1037. }
  1038. inline float
  1039. cyl_bessel_jf(float __nu, float __x)
  1040. { return __detail::__cyl_bessel_j<float>(__nu, __x); }
  1041. inline long double
  1042. cyl_bessel_jl(long double __nu, long double __x)
  1043. { return __detail::__cyl_bessel_j<long double>(__nu, __x); }
  1044. /// 5.2.1.9 Cylindrical Bessel functions (of the first kind).
  1045. template<typename _Tpnu, typename _Tp>
  1046. inline typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type
  1047. cyl_bessel_j(_Tpnu __nu, _Tp __x)
  1048. {
  1049. typedef typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type __type;
  1050. return __detail::__cyl_bessel_j<__type>(__nu, __x);
  1051. }
  1052. inline float
  1053. cyl_bessel_kf(float __nu, float __x)
  1054. { return __detail::__cyl_bessel_k<float>(__nu, __x); }
  1055. inline long double
  1056. cyl_bessel_kl(long double __nu, long double __x)
  1057. { return __detail::__cyl_bessel_k<long double>(__nu, __x); }
  1058. /// 5.2.1.10 Irregular modified cylindrical Bessel functions.
  1059. template<typename _Tpnu, typename _Tp>
  1060. inline typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type
  1061. cyl_bessel_k(_Tpnu __nu, _Tp __x)
  1062. {
  1063. typedef typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type __type;
  1064. return __detail::__cyl_bessel_k<__type>(__nu, __x);
  1065. }
  1066. inline float
  1067. cyl_neumannf(float __nu, float __x)
  1068. { return __detail::__cyl_neumann_n<float>(__nu, __x); }
  1069. inline long double
  1070. cyl_neumannl(long double __nu, long double __x)
  1071. { return __detail::__cyl_neumann_n<long double>(__nu, __x); }
  1072. /// 5.2.1.11 Cylindrical Neumann functions.
  1073. template<typename _Tpnu, typename _Tp>
  1074. inline typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type
  1075. cyl_neumann(_Tpnu __nu, _Tp __x)
  1076. {
  1077. typedef typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type __type;
  1078. return __detail::__cyl_neumann_n<__type>(__nu, __x);
  1079. }
  1080. inline float
  1081. ellint_1f(float __k, float __phi)
  1082. { return __detail::__ellint_1<float>(__k, __phi); }
  1083. inline long double
  1084. ellint_1l(long double __k, long double __phi)
  1085. { return __detail::__ellint_1<long double>(__k, __phi); }
  1086. /// 5.2.1.12 Incomplete elliptic integrals of the first kind.
  1087. template<typename _Tp, typename _Tpp>
  1088. inline typename __gnu_cxx::__promote_2<_Tp, _Tpp>::__type
  1089. ellint_1(_Tp __k, _Tpp __phi)
  1090. {
  1091. typedef typename __gnu_cxx::__promote_2<_Tp, _Tpp>::__type __type;
  1092. return __detail::__ellint_1<__type>(__k, __phi);
  1093. }
  1094. inline float
  1095. ellint_2f(float __k, float __phi)
  1096. { return __detail::__ellint_2<float>(__k, __phi); }
  1097. inline long double
  1098. ellint_2l(long double __k, long double __phi)
  1099. { return __detail::__ellint_2<long double>(__k, __phi); }
  1100. /// 5.2.1.13 Incomplete elliptic integrals of the second kind.
  1101. template<typename _Tp, typename _Tpp>
  1102. inline typename __gnu_cxx::__promote_2<_Tp, _Tpp>::__type
  1103. ellint_2(_Tp __k, _Tpp __phi)
  1104. {
  1105. typedef typename __gnu_cxx::__promote_2<_Tp, _Tpp>::__type __type;
  1106. return __detail::__ellint_2<__type>(__k, __phi);
  1107. }
  1108. inline float
  1109. ellint_3f(float __k, float __nu, float __phi)
  1110. { return __detail::__ellint_3<float>(__k, __nu, __phi); }
  1111. inline long double
  1112. ellint_3l(long double __k, long double __nu, long double __phi)
  1113. { return __detail::__ellint_3<long double>(__k, __nu, __phi); }
  1114. /// 5.2.1.14 Incomplete elliptic integrals of the third kind.
  1115. template<typename _Tp, typename _Tpn, typename _Tpp>
  1116. inline typename __gnu_cxx::__promote_3<_Tp, _Tpn, _Tpp>::__type
  1117. ellint_3(_Tp __k, _Tpn __nu, _Tpp __phi)
  1118. {
  1119. typedef typename __gnu_cxx::__promote_3<_Tp, _Tpn, _Tpp>::__type __type;
  1120. return __detail::__ellint_3<__type>(__k, __nu, __phi);
  1121. }
  1122. inline float
  1123. expintf(float __x)
  1124. { return __detail::__expint<float>(__x); }
  1125. inline long double
  1126. expintl(long double __x)
  1127. { return __detail::__expint<long double>(__x); }
  1128. /// 5.2.1.15 Exponential integrals.
  1129. template<typename _Tp>
  1130. inline typename __gnu_cxx::__promote<_Tp>::__type
  1131. expint(_Tp __x)
  1132. {
  1133. typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
  1134. return __detail::__expint<__type>(__x);
  1135. }
  1136. inline float
  1137. hermitef(unsigned int __n, float __x)
  1138. { return __detail::__poly_hermite<float>(__n, __x); }
  1139. inline long double
  1140. hermitel(unsigned int __n, long double __x)
  1141. { return __detail::__poly_hermite<long double>(__n, __x); }
  1142. /// 5.2.1.16 Hermite polynomials.
  1143. template<typename _Tp>
  1144. inline typename __gnu_cxx::__promote<_Tp>::__type
  1145. hermite(unsigned int __n, _Tp __x)
  1146. {
  1147. typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
  1148. return __detail::__poly_hermite<__type>(__n, __x);
  1149. }
  1150. inline float
  1151. hypergf(float __a, float __b, float __c, float __x)
  1152. { return __detail::__hyperg<float>(__a, __b, __c, __x); }
  1153. inline long double
  1154. hypergl(long double __a, long double __b, long double __c, long double __x)
  1155. { return __detail::__hyperg<long double>(__a, __b, __c, __x); }
  1156. /// 5.2.1.17 Hypergeometric functions.
  1157. template<typename _Tpa, typename _Tpb, typename _Tpc, typename _Tp>
  1158. inline typename __gnu_cxx::__promote_4<_Tpa, _Tpb, _Tpc, _Tp>::__type
  1159. hyperg(_Tpa __a, _Tpb __b, _Tpc __c, _Tp __x)
  1160. {
  1161. typedef typename __gnu_cxx::__promote_4<_Tpa, _Tpb, _Tpc, _Tp>::__type __type;
  1162. return __detail::__hyperg<__type>(__a, __b, __c, __x);
  1163. }
  1164. inline float
  1165. laguerref(unsigned int __n, float __x)
  1166. { return __detail::__laguerre<float>(__n, __x); }
  1167. inline long double
  1168. laguerrel(unsigned int __n, long double __x)
  1169. { return __detail::__laguerre<long double>(__n, __x); }
  1170. /// 5.2.1.18 Laguerre polynomials.
  1171. template<typename _Tp>
  1172. inline typename __gnu_cxx::__promote<_Tp>::__type
  1173. laguerre(unsigned int __n, _Tp __x)
  1174. {
  1175. typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
  1176. return __detail::__laguerre<__type>(__n, __x);
  1177. }
  1178. inline float
  1179. legendref(unsigned int __n, float __x)
  1180. { return __detail::__poly_legendre_p<float>(__n, __x); }
  1181. inline long double
  1182. legendrel(unsigned int __n, long double __x)
  1183. { return __detail::__poly_legendre_p<long double>(__n, __x); }
  1184. /// 5.2.1.19 Legendre polynomials.
  1185. template<typename _Tp>
  1186. inline typename __gnu_cxx::__promote<_Tp>::__type
  1187. legendre(unsigned int __n, _Tp __x)
  1188. {
  1189. typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
  1190. return __detail::__poly_legendre_p<__type>(__n, __x);
  1191. }
  1192. inline float
  1193. riemann_zetaf(float __x)
  1194. { return __detail::__riemann_zeta<float>(__x); }
  1195. inline long double
  1196. riemann_zetal(long double __x)
  1197. { return __detail::__riemann_zeta<long double>(__x); }
  1198. /// 5.2.1.20 Riemann zeta function.
  1199. template<typename _Tp>
  1200. inline typename __gnu_cxx::__promote<_Tp>::__type
  1201. riemann_zeta(_Tp __x)
  1202. {
  1203. typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
  1204. return __detail::__riemann_zeta<__type>(__x);
  1205. }
  1206. inline float
  1207. sph_besself(unsigned int __n, float __x)
  1208. { return __detail::__sph_bessel<float>(__n, __x); }
  1209. inline long double
  1210. sph_bessell(unsigned int __n, long double __x)
  1211. { return __detail::__sph_bessel<long double>(__n, __x); }
  1212. /// 5.2.1.21 Spherical Bessel functions.
  1213. template<typename _Tp>
  1214. inline typename __gnu_cxx::__promote<_Tp>::__type
  1215. sph_bessel(unsigned int __n, _Tp __x)
  1216. {
  1217. typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
  1218. return __detail::__sph_bessel<__type>(__n, __x);
  1219. }
  1220. inline float
  1221. sph_legendref(unsigned int __l, unsigned int __m, float __theta)
  1222. { return __detail::__sph_legendre<float>(__l, __m, __theta); }
  1223. inline long double
  1224. sph_legendrel(unsigned int __l, unsigned int __m, long double __theta)
  1225. { return __detail::__sph_legendre<long double>(__l, __m, __theta); }
  1226. /// 5.2.1.22 Spherical associated Legendre functions.
  1227. template<typename _Tp>
  1228. inline typename __gnu_cxx::__promote<_Tp>::__type
  1229. sph_legendre(unsigned int __l, unsigned int __m, _Tp __theta)
  1230. {
  1231. typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
  1232. return __detail::__sph_legendre<__type>(__l, __m, __theta);
  1233. }
  1234. inline float
  1235. sph_neumannf(unsigned int __n, float __x)
  1236. { return __detail::__sph_neumann<float>(__n, __x); }
  1237. inline long double
  1238. sph_neumannl(unsigned int __n, long double __x)
  1239. { return __detail::__sph_neumann<long double>(__n, __x); }
  1240. /// 5.2.1.23 Spherical Neumann functions.
  1241. template<typename _Tp>
  1242. inline typename __gnu_cxx::__promote<_Tp>::__type
  1243. sph_neumann(unsigned int __n, _Tp __x)
  1244. {
  1245. typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
  1246. return __detail::__sph_neumann<__type>(__n, __x);
  1247. }
  1248. /* @} */ // tr1_math_spec_func
  1249. _GLIBCXX_END_NAMESPACE_VERSION
  1250. }
  1251. }
  1252. #endif // _GLIBCXX_TR1_CMATH