Changeset a5b6997 in sasmodels
- Timestamp:
- Oct 14, 2016 6:07:28 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:
- 4962519
- Parents:
- 3a48772
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/lib/Si.c
r0278e3f ra5b6997 3 3 double Si(double x) 4 4 { 5 double out; 5 if (x >= M_PI*6.2/4.0){ 6 const double z = 1./(x*x); 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; 6 10 7 if (x >= M_PI*6.2/4.0){8 double out_sin = 0.0;9 double out_cos = 0.0;10 out = M_PI/2.0;11 11 double cos_x, sin_x; 12 SINCOS(x, cos_x, sin_x); 13 return M_PI_2 - cos_x*out_cos - sin_x*out_sin; 14 } else { 15 const double z = x*x; 12 16 // Explicitly writing factorial values triples the speed of the calculation 13 out_cos = 1./x - 2./pow(x,3) + 24./pow(x,5) - 720./pow(x,7);14 out_sin = 1./pow(x,2) - 6./pow(x,4) + 120./pow(x,6) - 5040./pow(x,8);15 16 out -= cos(x) * out_cos;17 out -= sin(x) * out_sin;18 return out;17 return (((((-1./439084800.*z 18 + 1./3265920.)*z 19 - 1./35280.)*z 20 + 1./600.)*z 21 - 1./18.)*z 22 + 1.)*x; 19 23 } 20 21 // Explicitly writing factorial values triples the speed of the calculation22 out = x - pow(x, 3)/18. + pow(x,5)/600. - pow(x,7)/35280. + pow(x,9)/3265920. - pow(x,11)/439084800.;23 24 return out;25 24 }
Note: See TracChangeset
for help on using the changeset viewer.