Changeset 92ce163 in sasmodels


Ignore:
Timestamp:
Oct 17, 2016 11:49:41 AM (8 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, core_shell_microgels, costrafo411, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
73e08ae
Parents:
9aa4881
Message:

fix error introduced with conversion to Horner's method; code cleanup

Location:
sasmodels/models
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/flexible_cylinder_elliptical.c

    r4962519 r92ce163  
    1515elliptical_crosssection(double q, double a, double b) 
    1616{ 
    17     double summ=0.0; 
     17    double sum=0.0; 
    1818 
    1919    for(int i=0;i<N_POINTS_76;i++) { 
    20         double zi = ( Gauss76Z[i] + 1.0 )*M_PI_4; 
     20        const double zi = ( Gauss76Z[i] + 1.0 )*M_PI_4; 
    2121        double sn, cn; 
    2222        SINCOS(zi, sn, cn); 
    23         double arg = q*sqrt(a*a*sn*sn + b*b*cn*cn); 
    24         double yyy = sas_J1c(arg); 
    25         summ += Gauss76Wt[i] * yyy * yyy; 
     23        const double arg = q*sqrt(a*a*sn*sn + b*b*cn*cn); 
     24        const double yyy = sas_J1c(arg); 
     25        sum += Gauss76Wt[i] * yyy * yyy; 
    2626    } 
    27  
    28     summ /= 2.0; 
    29     return(summ); 
     27    sum *= 0.5; 
     28    return(sum); 
    3029 
    3130} 
  • sasmodels/models/lib/wrc_cyl.c

    r4962519 r92ce163  
    2222{ 
    2323    const double r = b/L; 
    24     return (L*b/6.0) * (1.0 - r*(1.5 + r*(1.5 + r*0.75*expm1(-2.0/r)))); 
     24    return (L*b/6.0) * (1.0 + r*(-1.5 + r*(1.5 + r*0.75*expm1(-2.0/r)))); 
     25 
    2526} 
    2627 
Note: See TracChangeset for help on using the changeset viewer.