Changeset f719764 in sasmodels
- Timestamp:
- Oct 17, 2016 1:42:01 PM (8 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:
- 9aa4881
- Parents:
- 2126131
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/lib/Si.c
ra5b6997 rf719764 3 3 double Si(double x) 4 4 { 5 if (x >= M_PI*6.2/4.0) {6 const double z= 1./(x*x);5 if (x >= M_PI*6.2/4.0) { 6 const double xxinv = 1./(x*x); 7 7 // Explicitly writing factorial values triples the speed of the calculation 8 const double out_cos = (((-720.* z + 24.)*z - 2.)*z+ 1.)/x;9 const double out_sin = (((-5040.* z + 120.)*z - 6.)*z + 1)*z;8 const double out_cos = (((-720.*xxinv + 24.)*xxinv - 2.)*xxinv + 1.)/x; 9 const double out_sin = (((-5040.*xxinv + 120.)*xxinv - 6.)*xxinv + 1)*xxinv; 10 10 11 double cos_x, sin_x;12 SINCOS(x, cos_x, sin_x);11 double sin_x, cos_x; 12 SINCOS(x, sin_x, cos_x); 13 13 return M_PI_2 - cos_x*out_cos - sin_x*out_sin; 14 14 } else { 15 const double z= x*x;15 const double xx = x*x; 16 16 // Explicitly writing factorial values triples the speed of the calculation 17 return (((((-1./439084800.* z18 + 1./3265920.)* z19 - 1./35280.)* z20 + 1./600.)* z21 - 1./18.)* z17 return (((((-1./439084800.*xx 18 + 1./3265920.)*xx 19 - 1./35280.)*xx 20 + 1./600.)*xx 21 - 1./18.)*xx 22 22 + 1.)*x; 23 23 }
Note: See TracChangeset
for help on using the changeset viewer.