Changeset cae6ce6 in sasmodels
- Timestamp:
- Mar 17, 2016 12:17:00 PM (9 years ago)
- Branches:
- master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- 684eff9
- Parents:
- 070ecee
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/lib/lgamma.c
r070ecee rcae6ce6 1 /* gamma.c 2 * 3 * Gamma function 1 /* lgamma.c 2 * 3 * Log Gamma function 4 * 5 */ 6 7 /* lgamma() 8 * 9 * Natural logarithm of gamma function 4 10 * 5 11 * … … 7 13 * SYNOPSIS: 8 14 * 9 * double x, y, gamma();15 * double x, y, lgamma(); 10 16 * extern int sgngam; 11 17 * 12 * y = gamma( x ); 13 * 14 * 15 * 16 * DESCRIPTION: 17 * 18 * Returns gamma function of the argument. The result is 19 * correctly signed, and the sign (+1 or -1) is also 20 * returned in a global (extern) variable named sgngam. 21 * This variable is also filled in by the logarithmic gamma 22 * function lgam(). 23 * 24 * Arguments |x| <= 34 are reduced by recurrence and the function 25 * approximated by a rational function of degree 6/7 in the 26 * interval (2,3). Large arguments are handled by Stirling's 27 * formula. Large negative arguments are made positive using 28 * a reflection formula. 29 * 30 * 31 * ACCURACY: 32 * 33 * Relative error: 34 * arithmetic domain # trials peak rms 35 * DEC -34, 34 10000 1.3e-16 2.5e-17 36 * IEEE -170,-33 20000 2.3e-15 3.3e-16 37 * IEEE -33, 33 20000 9.4e-16 2.2e-16 38 * IEEE 33, 171.6 20000 2.3e-15 3.2e-16 39 * 40 * Error for arguments outside the test range will be larger 41 * owing to error amplification by the exponential function. 42 * 43 */ 44 45 /* lgam() 46 * 47 * Natural logarithm of gamma function 48 * 49 * 50 * 51 * SYNOPSIS: 52 * 53 * double x, y, lgam(); 54 * extern int sgngam; 55 * 56 * y = lgam( x ); 18 * y = lgamma( x ); 57 19 * 58 20 * … … 98 60 99 61 100 /* gamma.c */101 /* gamma function */102 103 62 /* 104 63 Cephes Math Library Release 2.8: June, 2000 … … 107 66 108 67 109 double l anczos_gamma( double );110 111 double l anczos_gamma( double x) {68 double lgamma( double ); 69 70 double lgamma( double x) { 112 71 113 72 #if FLOAT_SIZE > 4
Note: See TracChangeset
for help on using the changeset viewer.