Changeset 3a220e6 in sasmodels for sasmodels/models
- Timestamp:
- Oct 3, 2017 3:56:55 PM (7 years ago)
- Branches:
- master, core_shell_microgels, costrafo411, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- 237c9cf
- Parents:
- 6e72989
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/lib/wrc_cyl.c
r6e72989 r3a220e6 121 121 { 122 122 #if FLOAT_SIZE>4 123 #define DEBYE_CUTOFF 0. 01 // 1e-13error123 #define DEBYE_CUTOFF 0.1 // 1e-14 error 124 124 #else 125 #define DEBYE_CUTOFF 1.0 // 1e-7 error125 #define DEBYE_CUTOFF 0.9 // 4e-7 error 126 126 #endif 127 128 /* For double precision, the following gets 1e-15 error rather than 1e-14 129 if (qsq < 9./16.) { 130 // PadeApproximant[2*Exp[-x^2] + x^2-1)/x^4, {x, 0, 8}] 131 const double A1=1./12., A2=2./99., A3=1./2640., A4=1./23760., A5=-1./1995840.; 132 const double B1=5./12., B2=5./66., B3=1./132., B4=1./2376., B5=1./95040.; 133 const double x = qsq; 134 return (((((A5*x + A4)*x + A3)*x + A2)*x + A1)*x + 1.) 135 /(((((B5*x + B4)*x + B3)*x + B2)*x + B1)*x + 1.); 136 } 137 */ 127 138 128 139 if (qsq < DEBYE_CUTOFF) { … … 137 148 const double C7 = -1./181440.; 138 149 return ((((((C7*x + C6)*x + C5)*x + C4)*x + C3)*x + C2)*x + C1)*x + C0; 139 /* failed attempt to improve double precision better than 1e-13140 } else if (qsq < 1.0) {141 // taylor series around q^2 = 0.5142 const double x = qsq - 0.5;143 const double sqrt_e = sqrt(M_E);144 const double C0 = 8./sqrt_e - 4.;145 const double C1 = 24. - 40./sqrt_e;146 const double C2 = 132./sqrt_e - 80.;147 const double C3 = 224. - 1108./(3.*sqrt_e);148 const double C4 = 2849./(3.*sqrt_e) - 576.;149 const double C5 = 1408 - 11607./(5.*sqrt_e);150 return ((((C5*x + C4)*x + C3)*x + C2)*x + C1)*x + C0;151 */152 150 } else { 153 151 return 2.*(exp(-qsq) + qsq - 1.)/(qsq*qsq);
Note: See TracChangeset
for help on using the changeset viewer.