Changeset e7678b2 in sasmodels for sasmodels/models/lib/Si.c


Ignore:
Timestamp:
Feb 29, 2016 8:21:55 AM (8 years ago)
Author:
piotr
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
Message:

Code review from PAK

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/lib/Si.c

    rf12357f re7678b2  
    44double Si(double x) 
    55{ 
    6         double out; 
    7         double pi = 4.0*atan(1.0); 
     6    double out; 
    87 
    9         if (x >= pi*6.2/4.0){ 
    10                 double out_sin = 0.0; 
    11                 double out_cos = 0.0; 
    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; 
    1312 
    14                 // Explicitly writing factorial values triples the speed of the calculation 
    15                 out_cos = 1./x - 2./pow(x,3) + 24./pow(x,5) - 720./pow(x,7); 
    16                 out_sin = 1./pow(x,2) - 6./pow(x,4) + 120./pow(x,6) - 5040./pow(x,8); 
     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); 
    1716 
    18                 out -= cos(x) * out_cos; 
    19                 out -= sin(x) * out_sin; 
    20                 return out; 
    21         } 
     17        out -= cos(x) * out_cos; 
     18        out -= sin(x) * out_sin; 
     19        return out; 
     20    } 
    2221 
    23         // Explicitly writing factorial values triples the speed of the calculation 
    24         out = x - pow(x, 3)/18. + pow(x,5)/600. - pow(x,7)/35280. + pow(x,9)/3265920. - pow(x,11)/439084800.; 
     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.; 
    2524 
    26         return out; 
     25    return out; 
    2726} 
Note: See TracChangeset for help on using the changeset viewer.