-
Notifications
You must be signed in to change notification settings - Fork 0
/
ldoubdoc.html
4221 lines (4219 loc) · 93.7 KB
/
ldoubdoc.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE>Cephes long double precision special functions suite</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="description" CONTENT="Long double precision special functions suite of Cephes Mathematical Library.">
<META NAME="keywords" CONTENT="numerical analysis, special functions, Cephes">
<META NAME="GENERATOR" CONTENT="Mozilla/4.04 [en] (X11; I; Linux 2.0.32 i486) [Netscape]">
</HEAD>
<BODY>
<H3>Cephes Mathematical Library</H3>
<H3>Source code archives</H3>
<BR><A HREF="singldoc.html">Documentation for single precision library.</A>
<BR><A HREF="doubldoc.html">Documentation for double precision library.</A>
<BR><A HREF="ldoubdoc.html">Documentation for 80-bit long double library.</A>
<BR><A HREF="128bdoc.html">Documentation for 128-bit long double library.</A>
<BR><A HREF="qlibdoc.html">Documentation for extended precision library.</A>
<H3>Long Double Precision Special Functions</H3>
Select function name for additional information.
For other precisions, see the archives and descriptions listed above.
<DIR>
<LI><A HREF="#acosh">acoshl, Inverse hyperbolic cosine</A>
<LI><A HREF="#arcdot">arcdotl, Angle between two vectors</A>
<LI><A HREF="#asinh">asinh, Inverse hyperbolic sine</A>
<LI><A HREF="#asin">asin, Inverse circular sine</A>
<LI><A HREF="#acos">acos, Inverse circular cosine</A>
<LI><A HREF="#atanh">atanh, Inverse hyperbolic tangent</A>
<LI><A HREF="#atan">atan, Inverse circular tangent</A>
<LI><A HREF="#atan2">atan2, Quadrant correct inverse circular tangent</A>
<LI><A HREF="#bdtr">bdtr, Binomial distribution</A>
<LI><A HREF="#bdtrc">bdtrc, Complemented binomial distribution</A>
<LI><A HREF="#bdtri">bdtri, Inverse binomial distribution</A>
<LI><A HREF="#btdtr">btdtr, Beta distribution</A>
<LI><A HREF="#cbrt">cbrt, Cube root</A>
<LI><A HREF="#chdtr">chdtr, Chi-square distribution</A>
<LI><A HREF="#chdtrc">chdtrc, Complemented Chi-square distribution</A>
<LI><A HREF="#chdtri">chdtri, Inverse of complemented Chi-square distribution</A>
<LI><A HREF="#clog">clog, Complex natural logarithm</A>
<LI><A HREF="#cexp">cexp, Complex exponential function</A>
<LI><A HREF="#csin">csin, Complex circular sine</A>
<LI><A HREF="#ccos">ccos, Complex circular cosine</A>
<LI><A HREF="#ctan">ctan, Complex circular tangent</A>
<LI><A HREF="#ccot">ccot, Complex circular cotangent</A>
<LI><A HREF="#casin">casin, Complex circular arc sine</A>
<LI><A HREF="#cacos">cacos, Complex circular arc cosine</A>
<LI><A HREF="#catan">catan, Complex circular arc tangent</A>
<LI><A HREF="#cmplx">cmplx, Complex number arithmetic</A>
<LI><A HREF="#cosh">cosh, Hyperbolic cosine</A>
<LI><A HREF="#ellie">ellie, Incomplete elliptic integral of the second kind</A>
<LI><A HREF="#ellik">ellik, Incomplete elliptic integral of the first kind</A>
<LI><A HREF="#ellpe">ellpe, Complete elliptic integral of the second kind</A>
<LI><A HREF="#ellpj">ellpj, Jacobian elliptic functions</A>
<LI><A HREF="#ellpk">ellpk, Complete elliptic integral of the first kind</A>
<LI><A HREF="#exp10">exp10, Base 10 exponential function</A>
<LI><A HREF="#exp2">exp2, Base 2 exponential function</A>
<LI><A HREF="#exp">exp, Exponential function</A>
<LI><A HREF="#expm1">expm1, Exponential function, minus 1</A>
<LI><A HREF="#expx2">expx2, Exponential function</A>
<LI><A HREF="#fdtr">fdtr, F distribution</A>
<LI><A HREF="#fdtrc">fdtrc, Complemented F distribution</A>
<LI><A HREF="#fdtri">fdtri, Inverse of complemented F distribution</A>
<LI><A HREF="#floor">floor, Floor function</A>
<LI><A HREF="#ceil">ceil, Ceil function</A>
<LI><A HREF="#frexp">frexp, Extract exponent</A>
<LI><A HREF="#ldexp">ldexp, Apply exponent</A>
<LI><A HREF="#fabs">fabs, Absolute value</A>
<LI><A HREF="#gamma">gamma, Gamma function</A>
<LI><A HREF="#lgam">lgam, Natural logarithm of gamma function</A>
<LI><A HREF="#gdtr">gdtr, Gamma distribution function</A>
<LI><A HREF="#gdtrc">gdtrc, Complemented gamma distribution function</A>
<LI><A HREF="#gels">gels, Linear system with symmetric coefficient matrix</A>
<LI><A HREF="#hyperg">hyperg, Confluent hypergeometric function</A>
<LI><A HREF="#ieee">ieee, Extended precision arithmetic</A>
<LI><A HREF="#igami">igami, Inverse of complemented imcomplete gamma integral</A>
<LI><A HREF="#igam">igam, Incomplete gamma integral</A>
<LI><A HREF="#igamc">igamc, Complemented incomplete gamma integral</A>
<LI><A HREF="#incbet">incbet, Incomplete beta integral</A>
<LI><A HREF="#incbi">incbi, Inverse of imcomplete beta integral</A>
<LI><A HREF="#isnan">isnan, Test for not a number</A>
<LI><A HREF="#isfinite">isfinite, Test for infinity</A>
<LI><A HREF="#signbit">signbit, Extract sign</A>
<LI><A HREF="#j0">j0, Bessel function of order zero</A>
<LI><A HREF="#y0">y0, Bessel function of the second kind, order zero</A>
<LI><A HREF="#j1">j1, Bessel function of order one</A>
<LI><A HREF="#y1">y1, Bessel function of the second kind, order one</A>
<LI><A HREF="#jn">jn, Bessel function of integer order</A>
<LI><A HREF="#ldrand">ldrand, Pseudorandom number generator</A>
<LI><A HREF="#log10">log10, Common logarithm</A>
<LI><A HREF="#log1p">log1p, Relative error logarithm</A>
<LI><A HREF="#log2">log2, Base 2 logarithm</A>
<LI><A HREF="#log">log, Natural logarithm</A>
<LI><A HREF="#mtherr">mtherr, Library common error handling routine</A>
<LI><A HREF="#nbdtr">nbdtr, Negative binomial distribution</A>
<LI><A HREF="#nbdtrc">nbdtrc, Complemented negative binomial distribution</A>
<LI><A HREF="#nbdtri">nbdtri, Functional inverse of negative binomial distribution</A>
<LI><A HREF="#ndtri">ndtri, Inverse of normal distribution function</A>
<LI><A HREF="#ndtr">ndtr, Normal distribution function</A>
<LI><A HREF="#erf">erf, Error function</A>
<LI><A HREF="#erfc">erfc, Complementary error function</A>
<LI><A HREF="#pdtr">pdtr, Poisson distribution function</A>
<LI><A HREF="#pdtrc">pdtrc, Complemented Poisson distribution function</A>
<LI><A HREF="#pdtri">pdtri, Inverse of Poisson distribution function</A>
<LI><A HREF="#polevl">polevl, Evaluate polynomial</A>
<LI><A HREF="#p1evl">p1evl, Evaluate polynomial</A>
<LI><A HREF="#powi">powi, Integer power function</A>
<LI><A HREF="#pow">pow, Power function</A>
<LI><A HREF="#sinh">sinh, Hyperbolic sine</A>
<LI><A HREF="#sin">sin, Circular sine</A>
<LI><A HREF="#cos">cos, Circular cosine</A>
<LI><A HREF="#sqrt">sqrt, Square root</A>
<LI><A HREF="#stdtr">stdtr, Student's t distribution</A>
<LI><A HREF="#stdtri">stdtri, Functional inverse of Student's t distribution</A>
<LI><A HREF="#tanh">tanh, Hyperbolic tangent</A>
<LI><A HREF="#tan">tan, Circular tangent</A>
<LI><A HREF="#cot">cot, Circular cotangent</A>
<LI><A HREF="#cosm1">cosm1, Relative error cosine</A>
<LI><A HREF="#yn">yn, Bessel function of second kind of integer order</A>
</DIR>
<A NAME="acosh"> </A>
<PRE>
/* acoshl.c
*
* Inverse hyperbolic cosine, long double precision
*
*
*
* SYNOPSIS:
*
* long double x, y, acoshl();
*
* y = acoshl( x );
*
*
*
* DESCRIPTION:
*
* Returns inverse hyperbolic cosine of argument.
*
* If 1 <= x < 1.5, a rational approximation
*
* sqrt(2z) * P(z)/Q(z)
*
* where z = x-1, is used. Otherwise,
*
* acosh(x) = log( x + sqrt( (x-1)(x+1) ).
*
*
*
* ACCURACY:
*
* Relative error:
* arithmetic domain # trials peak rms
* IEEE 1,3 30000 2.0e-19 3.9e-20
*
*
* ERROR MESSAGES:
*
* message condition value returned
* acoshl domain |x| < 1 0.0
*
*/
</PRE>
<A NAME="arcdot"> </A>
<PRE>
/* arcdot.c
*
* Angle between two vectors
*
*
*
*
* SYNOPSIS:
*
* long double p[3], q[3], arcdotl();
*
* y = arcdotl( p, q );
*
*
*
* DESCRIPTION:
*
* For two vectors p, q, the angle A between them is given by
*
* p.q / (|p| |q|) = cos A .
*
* where "." represents inner product, "|x|" the length of vector x.
* If the angle is small, an expression in sin A is preferred.
* Set r = q - p. Then
*
* p.q = p.p + p.r ,
*
* |p|^2 = p.p ,
*
* |q|^2 = p.p + 2 p.r + r.r ,
*
* p.p^2 + 2 p.p p.r + p.r^2
* cos^2 A = ----------------------------
* p.p (p.p + 2 p.r + r.r)
*
* p.p + 2 p.r + p.r^2 / p.p
* = --------------------------- ,
* p.p + 2 p.r + r.r
*
* sin^2 A = 1 - cos^2 A
*
* r.r - p.r^2 / p.p
* = --------------------
* p.p + 2 p.r + r.r
*
* = (r.r - p.r^2 / p.p) / q.q .
*
* ACCURACY:
*
* About 1 ULP. See arcdot.c.
*
*/
</PRE>
<A NAME="asinh"> </A>
<PRE>
/* asinhl.c
*
* Inverse hyperbolic sine, long double precision
*
*
*
* SYNOPSIS:
*
* long double x, y, asinhl();
*
* y = asinhl( x );
*
*
*
* DESCRIPTION:
*
* Returns inverse hyperbolic sine of argument.
*
* If |x| < 0.5, the function is approximated by a rational
* form x + x**3 P(x)/Q(x). Otherwise,
*
* asinh(x) = log( x + sqrt(1 + x*x) ).
*
*
*
* ACCURACY:
*
* Relative error:
* arithmetic domain # trials peak rms
* IEEE -3,3 30000 1.7e-19 3.5e-20
*
*/
</PRE>
<A NAME="asin"> </A>
<PRE>
/* asinl.c
*
* Inverse circular sine, long double precision
*
*
*
* SYNOPSIS:
*
* double x, y, asinl();
*
* y = asinl( x );
*
*
*
* DESCRIPTION:
*
* Returns radian angle between -pi/2 and +pi/2 whose sine is x.
*
* A rational function of the form x + x**3 P(x**2)/Q(x**2)
* is used for |x| in the interval [0, 0.5]. If |x| > 0.5 it is
* transformed by the identity
*
* asin(x) = pi/2 - 2 asin( sqrt( (1-x)/2 ) ).
*
*
* ACCURACY:
*
* Relative error:
* arithmetic domain # trials peak rms
* IEEE -1, 1 30000 2.7e-19 4.8e-20
*
*
* ERROR MESSAGES:
*
* message condition value returned
* asinl domain |x| > 1 NANL
*
*/
</PRE>
<A NAME="acos"> </A>
<PRE>
/* acosl()
*
* Inverse circular cosine, long double precision
*
*
*
* SYNOPSIS:
*
* double x, y, acosl();
*
* y = acosl( x );
*
*
*
* DESCRIPTION:
*
* Returns radian angle between -pi/2 and +pi/2 whose cosine
* is x.
*
* Analytically, acos(x) = pi/2 - asin(x). However if |x| is
* near 1, there is cancellation error in subtracting asin(x)
* from pi/2. Hence if x < -0.5,
*
* acos(x) = pi - 2.0 * asin( sqrt((1+x)/2) );
*
* or if x > +0.5,
*
* acos(x) = 2.0 * asin( sqrt((1-x)/2) ).
*
*
* ACCURACY:
*
* Relative error:
* arithmetic domain # trials peak rms
* IEEE -1, 1 30000 1.4e-19 3.5e-20
*
*
* ERROR MESSAGES:
*
* message condition value returned
* acosl domain |x| > 1 NANL
*/
</PRE>
<A NAME="atanh"> </A>
<PRE>
/* atanhl.c
*
* Inverse hyperbolic tangent, long double precision
*
*
*
* SYNOPSIS:
*
* long double x, y, atanhl();
*
* y = atanhl( x );
*
*
*
* DESCRIPTION:
*
* Returns inverse hyperbolic tangent of argument in the range
* MINLOGL to MAXLOGL.
*
* If |x| < 0.5, the rational form x + x**3 P(x)/Q(x) is
* employed. Otherwise,
* atanh(x) = 0.5 * log( (1+x)/(1-x) ).
*
*
*
* ACCURACY:
*
* Relative error:
* arithmetic domain # trials peak rms
* IEEE -1,1 30000 1.1e-19 3.3e-20
*
*/
</PRE>
<A NAME="atan"> </A>
<PRE>
/* atanl.c
*
* Inverse circular tangent, long double precision
* (arctangent)
*
*
*
* SYNOPSIS:
*
* long double x, y, atanl();
*
* y = atanl( x );
*
*
*
* DESCRIPTION:
*
* Returns radian angle between -pi/2 and +pi/2 whose tangent
* is x.
*
* Range reduction is from four intervals into the interval
* from zero to tan( pi/8 ). The approximant uses a rational
* function of degree 3/4 of the form x + x**3 P(x)/Q(x).
*
*
*
* ACCURACY:
*
* Relative error:
* arithmetic domain # trials peak rms
* IEEE -10, 10 150000 1.3e-19 3.0e-20
*
*/
</PRE>
<A NAME="atan2"> </A>
<PRE>
/* atan2l()
*
* Quadrant correct inverse circular tangent,
* long double precision
*
*
*
* SYNOPSIS:
*
* long double x, y, z, atan2l();
*
* z = atan2l( y, x );
*
*
*
* DESCRIPTION:
*
* Returns radian angle whose tangent is y/x.
* Define compile time symbol ANSIC = 1 for ANSI standard,
* range -PI < z <= +PI, args (y,x); else ANSIC = 0 for range
* 0 to 2PI, args (x,y).
*
*
*
* ACCURACY:
*
* Relative error:
* arithmetic domain # trials peak rms
* IEEE -10, 10 60000 1.7e-19 3.2e-20
* See atan.c.
*
*/
</PRE>
<A NAME="bdtr"> </A>
<PRE>
/* bdtrl.c
*
* Binomial distribution
*
*
*
* SYNOPSIS:
*
* int k, n;
* long double p, y, bdtrl();
*
* y = bdtrl( k, n, p );
*
*
*
* DESCRIPTION:
*
* Returns the sum of the terms 0 through k of the Binomial
* probability density:
*
* k
* -- ( n ) j n-j
* > ( ) p (1-p)
* -- ( j )
* j=0
*
* The terms are not summed directly; instead the incomplete
* beta integral is employed, according to the formula
*
* y = bdtr( k, n, p ) = incbet( n-k, k+1, 1-p ).
*
* The arguments must be positive, with p ranging from 0 to 1.
*
*
*
* ACCURACY:
*
* Tested at random points (k,n,p) with a and b between 0
* and 10000 and p between 0 and 1.
* Relative error:
* arithmetic domain # trials peak rms
* IEEE 0,10000 3000 1.6e-14 2.2e-15
*
* ERROR MESSAGES:
*
* message condition value returned
* bdtrl domain k < 0 0.0
* n < k
* x < 0, x > 1
*
*/
</PRE>
<A NAME="bdtrc"> </A>
<PRE>
/* bdtrcl()
*
* Complemented binomial distribution
*
*
*
* SYNOPSIS:
*
* int k, n;
* long double p, y, bdtrcl();
*
* y = bdtrcl( k, n, p );
*
*
*
* DESCRIPTION:
*
* Returns the sum of the terms k+1 through n of the Binomial
* probability density:
*
* n
* -- ( n ) j n-j
* > ( ) p (1-p)
* -- ( j )
* j=k+1
*
* The terms are not summed directly; instead the incomplete
* beta integral is employed, according to the formula
*
* y = bdtrc( k, n, p ) = incbet( k+1, n-k, p ).
*
* The arguments must be positive, with p ranging from 0 to 1.
*
*
*
* ACCURACY:
*
* See incbet.c.
*
* ERROR MESSAGES:
*
* message condition value returned
* bdtrcl domain x<0, x>1, n<k 0.0
*/
</PRE>
<A NAME="bdtri"> </A>
<PRE>
/* bdtril()
*
* Inverse binomial distribution
*
*
*
* SYNOPSIS:
*
* int k, n;
* long double p, y, bdtril();
*
* p = bdtril( k, n, y );
*
*
*
* DESCRIPTION:
*
* Finds the event probability p such that the sum of the
* terms 0 through k of the Binomial probability density
* is equal to the given cumulative probability y.
*
* This is accomplished using the inverse beta integral
* function and the relation
*
* 1 - p = incbi( n-k, k+1, y ).
*
* ACCURACY:
*
* See incbi.c.
* Tested at random k, n between 1 and 10000. The "domain" refers to p:
* Relative error:
* arithmetic domain # trials peak rms
* IEEE 0,1 3500 2.0e-15 8.2e-17
*
* ERROR MESSAGES:
*
* message condition value returned
* bdtril domain k < 0, n <= k 0.0
* x < 0, x > 1
*/
</PRE>
<A NAME="btdtr"> </A>
<PRE>
/* btdtrl.c
*
* Beta distribution
*
*
*
* SYNOPSIS:
*
* long double a, b, x, y, btdtrl();
*
* y = btdtrl( a, b, x );
*
*
*
* DESCRIPTION:
*
* Returns the area from zero to x under the beta density
* function:
*
*
* x
* - -
* | (a+b) | | a-1 b-1
* P(x) = ---------- | t (1-t) dt
* - - | |
* | (a) | (b) -
* 0
*
*
* The mean value of this distribution is a/(a+b). The variance
* is ab/[(a+b)^2 (a+b+1)].
*
* This function is identical to the incomplete beta integral
* function, incbetl(a, b, x).
*
* The complemented function is
*
* 1 - P(1-x) = incbetl( b, a, x );
*
*
* ACCURACY:
*
* See incbetl.c.
*
*/
</PRE>
<A NAME="cbrt"> </A>
<PRE>
/* cbrtl.c
*
* Cube root, long double precision
*
*
*
* SYNOPSIS:
*
* long double x, y, cbrtl();
*
* y = cbrtl( x );
*
*
*
* DESCRIPTION:
*
* Returns the cube root of the argument, which may be negative.
*
* Range reduction involves determining the power of 2 of
* the argument. A polynomial of degree 2 applied to the
* mantissa, and multiplication by the cube root of 1, 2, or 4
* approximates the root to within about 0.1%. Then Newton's
* iteration is used three times to converge to an accurate
* result.
*
*
*
* ACCURACY:
*
* Relative error:
* arithmetic domain # trials peak rms
* IEEE .125,8 80000 7.0e-20 2.2e-20
* IEEE exp(+-707) 100000 7.0e-20 2.4e-20
*
*/
</PRE>
<A NAME="chdtr"> </A>
<PRE>
/* chdtrl.c
*
* Chi-square distribution
*
*
*
* SYNOPSIS:
*
* long double df, x, y, chdtrl();
*
* y = chdtrl( df, x );
*
*
*
* DESCRIPTION:
*
* Returns the area under the left hand tail (from 0 to x)
* of the Chi square probability density function with
* v degrees of freedom.
*
*
* inf.
* -
* 1 | | v/2-1 -t/2
* P( x | v ) = ----------- | t e dt
* v/2 - | |
* 2 | (v/2) -
* x
*
* where x is the Chi-square variable.
*
* The incomplete gamma integral is used, according to the
* formula
*
* y = chdtr( v, x ) = igam( v/2.0, x/2.0 ).
*
*
* The arguments must both be positive.
*
*
*
* ACCURACY:
*
* See igam().
*
* ERROR MESSAGES:
*
* message condition value returned
* chdtr domain x < 0 or v < 1 0.0
*/
</PRE>
<A NAME="chdtrc"> </A>
<PRE>
/* chdtrcl()
*
* Complemented Chi-square distribution
*
*
*
* SYNOPSIS:
*
* long double v, x, y, chdtrcl();
*
* y = chdtrcl( v, x );
*
*
*
* DESCRIPTION:
*
* Returns the area under the right hand tail (from x to
* infinity) of the Chi square probability density function
* with v degrees of freedom:
*
*
* inf.
* -
* 1 | | v/2-1 -t/2
* P( x | v ) = ----------- | t e dt
* v/2 - | |
* 2 | (v/2) -
* x
*
* where x is the Chi-square variable.
*
* The incomplete gamma integral is used, according to the
* formula
*
* y = chdtr( v, x ) = igamc( v/2.0, x/2.0 ).
*
*
* The arguments must both be positive.
*
*
*
* ACCURACY:
*
* See igamc().
*
* ERROR MESSAGES:
*
* message condition value returned
* chdtrc domain x < 0 or v < 1 0.0
*/
</PRE>
<A NAME="chdtri"> </A>
<PRE>
/* chdtril()
*
* Inverse of complemented Chi-square distribution
*
*
*
* SYNOPSIS:
*
* long double df, x, y, chdtril();
*
* x = chdtril( df, y );
*
*
*
*
* DESCRIPTION:
*
* Finds the Chi-square argument x such that the integral
* from x to infinity of the Chi-square density is equal
* to the given cumulative probability y.
*
* This is accomplished using the inverse gamma integral
* function and the relation
*
* x/2 = igami( df/2, y );
*
*
*
*
* ACCURACY:
*
* See igami.c.
*
* ERROR MESSAGES:
*
* message condition value returned
* chdtri domain y < 0 or y > 1 0.0
* v < 1
*
*/
</PRE>
<A NAME="clog"> </A>
<PRE>
/* clogl.c
*
* Complex natural logarithm
*
*
*
* SYNOPSIS:
*
* void clogl();
* cmplxl z, w;
*
* clogl( &z, &w );
*
*
*
* DESCRIPTION:
*
* Returns complex logarithm to the base e (2.718...) of
* the complex argument x.
*
* If z = x + iy, r = sqrt( x**2 + y**2 ),
* then
* w = log(r) + i arctan(y/x).
*
* The arctangent ranges from -PI to +PI.
*
*
* ACCURACY:
*
* Relative error:
* arithmetic domain # trials peak rms
* DEC -10,+10 7000 8.5e-17 1.9e-17
* IEEE -10,+10 30000 5.0e-15 1.1e-16
*
* Larger relative error can be observed for z near 1 +i0.
* In IEEE arithmetic the peak absolute error is 5.2e-16, rms
* absolute error 1.0e-16.
*/
</PRE>
<A NAME="cexp"> </A>
<PRE>
/* cexpl()
*
* Complex exponential function
*
*
*
* SYNOPSIS:
*
* void cexpl();
* cmplxl z, w;
*
* cexpl( &z, &w );
*
*
*
* DESCRIPTION:
*
* Returns the exponential of the complex argument z
* into the complex result w.
*
* If
* z = x + iy,
* r = exp(x),
*
* then
*
* w = r cos y + i r sin y.
*
*
* ACCURACY:
*
* Relative error:
* arithmetic domain # trials peak rms
* DEC -10,+10 8700 3.7e-17 1.1e-17
* IEEE -10,+10 30000 3.0e-16 8.7e-17
*
*/
</PRE>
<A NAME="csin"> </A>
<PRE>
/* csinl()
*
* Complex circular sine
*
*
*
* SYNOPSIS:
*
* void csinl();
* cmplxl z, w;
*
* csinl( &z, &w );
*
*
*
* DESCRIPTION:
*
* If
* z = x + iy,
*
* then
*
* w = sin x cosh y + i cos x sinh y.
*
*
*
* ACCURACY:
*
* Relative error:
* arithmetic domain # trials peak rms
* DEC -10,+10 8400 5.3e-17 1.3e-17
* IEEE -10,+10 30000 3.8e-16 1.0e-16
* Also tested by csin(casin(z)) = z.
*
*/
</PRE>
<A NAME="ccos"> </A>
<PRE>
/* ccosl()
*
* Complex circular cosine
*
*
*
* SYNOPSIS:
*
* void ccosl();
* cmplxl z, w;
*
* ccosl( &z, &w );
*
*
*
* DESCRIPTION:
*
* If
* z = x + iy,
*
* then
*
* w = cos x cosh y - i sin x sinh y.
*
*
*
* ACCURACY:
*
* Relative error:
* arithmetic domain # trials peak rms
* DEC -10,+10 8400 4.5e-17 1.3e-17
* IEEE -10,+10 30000 3.8e-16 1.0e-16
*/
</PRE>
<A NAME="ctan"> </A>
<PRE>
/* ctanl()
*
* Complex circular tangent
*
*
*
* SYNOPSIS:
*
* void ctanl();
* cmplxl z, w;
*
* ctanl( &z, &w );
*
*
*
* DESCRIPTION:
*
* If
* z = x + iy,