Changeset e7678b2 in sasmodels for sasmodels/models/lib/Si.c
- Timestamp:
- Feb 29, 2016 8:21:55 AM (8 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:
- 73860b6
- Parents:
- deac08c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/lib/Si.c
rf12357f re7678b2 4 4 double Si(double x) 5 5 { 6 double out; 7 double pi = 4.0*atan(1.0); 6 double out; 8 7 9 if (x >= pi*6.2/4.0){10 11 12 out = pi/2.0;8 if (x >= M_PI*6.2/4.0){ 9 double out_sin = 0.0; 10 double out_cos = 0.0; 11 out = M_PI/2.0; 13 12 14 15 16 13 // Explicitly writing factorial values triples the speed of the calculation 14 out_cos = 1./x - 2./pow(x,3) + 24./pow(x,5) - 720./pow(x,7); 15 out_sin = 1./pow(x,2) - 6./pow(x,4) + 120./pow(x,6) - 5040./pow(x,8); 17 16 18 19 20 21 17 out -= cos(x) * out_cos; 18 out -= sin(x) * out_sin; 19 return out; 20 } 22 21 23 24 22 // Explicitly writing factorial values triples the speed of the calculation 23 out = x - pow(x, 3)/18. + pow(x,5)/600. - pow(x,7)/35280. + pow(x,9)/3265920. - pow(x,11)/439084800.; 25 24 26 25 return out; 27 26 }
Note: See TracChangeset
for help on using the changeset viewer.