23 long double x,
const long double a[],
int degree);
31 long double f,
g, x2,
s;
38 s = 0.5L - cosl(x2) * f - sinl(x2) *
g;
39 return (
x < 0.0L) ? -
s :
s;
45 long double f,
g, x2,
c;
52 c = 0.5L + sinl(x2) * f - cosl(x2) *
g;
53 return (
x < 0.0L) ? -
c :
c;
58 long double sqrt_2_o_pi = 7.978845608028653558798921198687637369517e-1L;
64 long double sqrt_2_o_pi = 7.978845608028653558798921198687637369517e-1L;
70 return static_cast<double>(
76 return static_cast<double>(
144 s = 0.5L - cosl(x2) * f - sinl(x2) *
g;
145 return (
x < 0.0L) ? -
s :
s;
174 long double x2 =
x *
x;
175 long double x3 =
x * x2;
176 long double x4 = -x2 * x2;
177 long double xn = 1.0L;
178 long double Sn = 1.0L;
179 long double Sm1 = 0.0L;
182 long double sqrt_2_o_pi = 7.978845608028653558798921198687637369517e-1L;
185 if (
x == 0.0L)
return 0.0L;
187 while (fabsl(Sn - Sm1) > LDBL_EPSILON * fabsl(Sm1))
195 term /= (
long double)(
y +
y +
y +
y + 3);
198 return x3 * sqrt_2_o_pi * Sn;
206 static long double const sqrt_2pi = 2.506628274631000502415765284811045253006L;
270 if (
x == 0.0L)
return 0.5L;
303 static long double const c[] = {
304 +2.560134650043040830997e-1L, -1.993005146464943284549e-1L,
305 +4.025503636721387266117e-2L, -4.459600454502960250729e-3L,
306 +6.447097305145147224459e-5L, +7.544218493763717599380e-5L,
307 -1.580422720690700333493e-5L, +1.755845848573471891519e-6L,
308 -9.289769688468301734718e-8L, -5.624033192624251079833e-9L,
309 +1.854740406702369495830e-9L, -2.174644768724492443378e-10L,
310 +1.392899828133395918767e-11L, -6.989216003725983789869e-14L,
311 -9.959396121060010838331e-14L, +1.312085140393647257714e-14L,
312 -9.240470383522792593305e-16L, +2.472168944148817385152e-17L,
313 +2.834615576069400293894e-18L, -4.650983461314449088349e-19L,
314 +3.544083040732391556797e-20L};
316 static const int degree =
sizeof(
c) /
sizeof(
long double) - 1;
317 static const long double midpoint = 0.5L;
318 static const long double scale = 0.5L;
348 static long double const c[] = {
349 +3.470341566046115476477e-2L, -3.855580521778624043304e-2L,
350 +1.420604309383996764083e-2L, -4.037349972538938202143e-3L,
351 +9.292478174580997778194e-4L, -1.742730601244797978044e-4L,
352 +2.563352976720387343201e-5L, -2.498437524746606551732e-6L,
353 -1.334367201897140224779e-8L, +7.436854728157752667212e-8L,
354 -2.059620371321272169176e-8L, +3.753674773239250330547e-9L,
355 -5.052913010605479996432e-10L, +4.580877371233042345794e-11L,
356 -7.664740716178066564952e-13L, -7.200170736686941995387e-13L,
357 +1.812701686438975518372e-13L, -2.799876487275995466163e-14L,
358 +3.048940815174731772007e-15L, -1.936754063718089166725e-16L,
359 -7.653673328908379651914e-18L, +4.534308864750374603371e-18L,
360 -8.011054486030591219007e-19L, +9.374587915222218230337e-20L,
361 -7.144943099280650363024e-21L, +1.105276695821552769144e-22L,
362 +6.989334213887669628647e-23L};
364 static const int degree =
sizeof(
c) /
sizeof(
long double) - 1;
365 static const long double midpoint = 2.0L;
395 static long double const c[] = {
396 +3.684922395955255848372e-3L, -2.624595437764014386717e-3L,
397 +6.329162500611499391493e-4L, -1.258275676151483358569e-4L,
398 +2.207375763252044217165e-5L, -3.521929664607266176132e-6L,
399 +5.186211398012883705616e-7L, -7.095056569102400546407e-8L,
400 +9.030550018646936241849e-9L, -1.066057806832232908641e-9L,
401 +1.157128073917012957550e-10L, -1.133877461819345992066e-11L,
402 +9.633572308791154852278e-13L, -6.336675771012312827721e-14L,
403 +1.634407356931822107368e-15L, +3.944542177576016972249e-16L,
404 -9.577486627424256130607e-17L, +1.428772744117447206807e-17L,
405 -1.715342656474756703926e-18L, +1.753564314320837957805e-19L,
406 -1.526125102356904908532e-20L, +1.070275366865736879194e-21L,
407 -4.783978662888842165071e-23L};
409 static const int degree =
sizeof(
c) /
sizeof(
long double) - 1;
410 static const long double midpoint = 4.0L;
440 static long double const c[] = {
441 +1.000801217561417083840e-3L, -4.915205279689293180607e-4L,
442 +8.133163567827942356534e-5L, -1.120758739236976144656e-5L,
443 +1.384441872281356422699e-6L, -1.586485067224130537823e-7L,
444 +1.717840749804993618997e-8L, -1.776373217323590289701e-9L,
445 +1.765399783094380160549e-10L, -1.692470022450343343158e-11L,
446 +1.568238301528778401489e-12L, -1.405356860742769958771e-13L,
447 +1.217377701691787512346e-14L, -1.017697418261094517680e-15L,
448 +8.186068056719295045596e-17L, -6.305153620995673221364e-18L,
449 +4.614110100197028845266e-19L, -3.165914620159266813849e-20L,
450 +1.986716456911232767045e-21L, -1.078418278174434671506e-22L,
451 +4.255983404468350776788e-24L};
453 static const int degree =
sizeof(
c) /
sizeof(
long double) - 1;
454 static const long double midpoint = 6.0L;
483 #define NUM_ASYMPTOTIC_TERMS 35
486 long double x2 =
x *
x;
487 long double x4 = -4.0L * x2 * x2;
488 long double xn = 1.0L;
490 long double g = 0.0L;
492 long double epsilon = LDBL_EPSILON / 4.0L;
500 factorial *= ((
long double)j * (
long double)(j - 2));
504 if (fabsl(term[i]) >= fabsl(term[i - 1]))
509 if (fabsl(term[i]) <= epsilon)
break;
511 for (; i >= 0; i--)
g += term[i];
514 return g / (x2 + x2);
582 if (
x == 0.0L)
return 0.5L;
658 c = 0.5L + sinl(x2) * f - cosl(x2) *
g;
659 return (
x < 0.0L) ? -
c :
c;
688 long double x2 =
x *
x;
690 long double x4 = -x2 * x2;
691 long double xn = 1.0L;
692 long double Sn = 1.0L;
693 long double Sm1 = 0.0L;
696 long double sqrt_2_o_pi = 7.978845608028653558798921198687637369517e-1L;
699 if (
x == 0.0L)
return 0.0L;
700 while (fabsl(Sn - Sm1) > LDBL_EPSILON * fabsl(Sm1))
708 term /= (
long double)(
y +
y +
y +
y + 1);
711 return x * sqrt_2_o_pi * Sn;
757 long double x,
const long double a[],
int degree)
759 long double yp2 = 0.0L;
760 long double yp1 = 0.0L;
761 long double y = 0.0L;
762 long double two_x =
x +
x;
767 if (degree < 0)
return 0.0L;
771 for (k = degree; k >= 1; k--, yp2 = yp1, yp1 =
y)
772 y = two_x * yp1 - yp2 +
a[k];
776 return x * yp1 - yp2 +
a[0];
804 static long double const c[] = {
805 +4.200987560240514577713e-1L, -9.358785913634965235904e-2L,
806 -7.642539415723373644927e-3L, +4.958117751796130135544e-3L,
807 -9.750236036106120253456e-4L, +1.075201474958704192865e-4L,
808 -4.415344769301324238886e-6L, -7.861633919783064216022e-7L,
809 +1.919240966215861471754e-7L, -2.175775608982741065385e-8L,
810 +1.296559541430849437217e-9L, +2.207205095025162212169e-11L,
811 -1.479219615873704298874e-11L, +1.821350127295808288614e-12L,
812 -1.228919312990171362342e-13L, +2.227139250593818235212e-15L,
813 +5.734729405928016301596e-16L, -8.284965573075354177016e-17L,
814 +6.067422701530157308321e-18L, -1.994908519477689596319e-19L,
815 -1.173365630675305693390e-20L};
817 static const int degree =
sizeof(
c) /
sizeof(
long double) - 1;
818 static const long double midpoint = 0.5L;
819 static const long double scale = 0.5L;
849 static long double const c[] = {
850 +2.098677278318224971989e-1L, -9.314234883154103266195e-2L,
851 +1.739905936938124979297e-2L, -2.454274824644285136137e-3L,
852 +1.589872606981337312438e-4L, +4.203943842506079780413e-5L,
853 -2.018022256093216535093e-5L, +5.125709636776428285284e-6L,
854 -9.601813551752718650057e-7L, +1.373989484857155846826e-7L,
855 -1.348105546577211255591e-8L, +2.745868700337953872632e-10L,
856 +2.401655517097260106976e-10L, -6.678059547527685587692e-11L,
857 +1.140562171732840809159e-11L, -1.401526517205212219089e-12L,
858 +1.105498827380224475667e-13L, +2.040731455126809208066e-16L,
859 -1.946040679213045143184e-15L, +4.151821375667161733612e-16L,
860 -5.642257647205149369594e-17L, +5.266176626521504829010e-18L,
861 -2.299025577897146333791e-19L, -2.952226367506641078731e-20L,
862 +8.760405943193778149078e-21L};
864 static const int degree =
sizeof(
c) /
sizeof(
long double) - 1;
865 static const long double midpoint = 2.0L;
895 static long double const c[] = {
896 +1.025703371090289562388e-1L, -2.569833023232301400495e-2L,
897 +3.160592981728234288078e-3L, -3.776110718882714758799e-4L,
898 +4.325593433537248833341e-5L, -4.668447489229591855730e-6L,
899 +4.619254757356785108280e-7L, -3.970436510433553795244e-8L,
900 +2.535664754977344448598e-9L, -2.108170964644819803367e-11L,
901 -2.959172018518707683013e-11L, +6.727219944906606516055e-12L,
902 -1.062829587519902899001e-12L, +1.402071724705287701110e-13L,
903 -1.619154679722651005075e-14L, +1.651319588396970446858e-15L,
904 -1.461704569438083772889e-16L, +1.053521559559583268504e-17L,
905 -4.760946403462515858756e-19L, -1.803784084922403924313e-20L,
906 +7.873130866418738207547e-21L};
908 static const int degree =
sizeof(
c) /
sizeof(
long double) - 1;
909 static const long double midpoint = 4.0L;
939 static long double const c[] = {
940 +6.738667333400589274018e-2L, -1.128146832637904868638e-2L,
941 +9.408843234170404670278e-4L, -7.800074103496165011747e-5L,
942 +6.409101169623350885527e-6L, -5.201350558247239981834e-7L,
943 +4.151668914650221476906e-8L, -3.242202015335530552721e-9L,
944 +2.460339340900396789789e-10L, -1.796823324763304661865e-11L,
945 +1.244108496436438952425e-12L, -7.950417122987063540635e-14L,
946 +4.419142625999150971878e-15L, -1.759082736751040110146e-16L,
947 -1.307443936270786700760e-18L, +1.362484141039320395814e-18L,
948 -2.055236564763877250559e-19L, +2.329142055084791308691e-20L,
949 -2.282438671525884861970e-21L};
951 static const int degree =
sizeof(
c) /
sizeof(
long double) - 1;
952 static const long double midpoint = 6.0L;
981 #define NUM_ASYMPTOTIC_TERMS 35
984 long double x2 =
x *
x;
985 long double x4 = -4.0L * x2 * x2;
986 long double xn = 1.0L;
988 long double f = 0.0L;
990 long double epsilon = LDBL_EPSILON / 4.0L;
998 factorial *= ((
long double)j * (
long double)(j - 2));
1002 if (fabsl(term[i]) >= fabsl(term[i - 1]))
1007 if (fabsl(term[i]) <= epsilon)
break;
1010 for (; i >= 0; i--) f += term[i];