Changeset 994d77f in sasmodels for sasmodels/models/lib/J1.c
- Timestamp:
- Oct 30, 2014 12:33:53 PM (10 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:
- ef2861b
- Parents:
- d087487b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/lib/J1.c
r14de349 r994d77f 1 real J1(realx);2 real J1(realx)1 double J1(double x); 2 double J1(double x) 3 3 { 4 const realax = fabs(x);5 if (ax < REAL(8.0)) {6 const realy = x*x;7 const real ans1 = x*(REAL(72362614232.0)8 + y*( REAL(-7895059235.0)9 + y*( REAL(242396853.1)10 + y*( REAL(-2972611.439)11 + y*( REAL(15704.48260)12 + y*( REAL(-30.16036606)))))));13 const real ans2 = REAL(144725228442.0)14 + y*( REAL(2300535178.0)15 + y*( REAL(18583304.74)16 + y*( REAL(99447.43394)17 + y*( REAL(376.9991397)4 const double ax = fabs(x); 5 if (ax < 8.0) { 6 const double y = x*x; 7 const double ans1 = x*(72362614232.0 8 + y*(-7895059235.0 9 + y*(242396853.1 10 + y*(-2972611.439 11 + y*(15704.48260 12 + y*(-30.16036606)))))); 13 const double ans2 = 144725228442.0 14 + y*(2300535178.0 15 + y*(18583304.74 16 + y*(99447.43394 17 + y*(376.9991397 18 18 + y)))); 19 19 return ans1/ans2; 20 20 } else { 21 const real y = REAL(64.0)/(ax*ax);22 const real xx = ax - REAL(2.356194491);23 const real ans1 = REAL(1.0)24 + y*( REAL(0.183105e-2)25 + y*( REAL(-0.3516396496e-4)26 + y*( REAL(0.2457520174e-5)27 + y* REAL(-0.240337019e-6))));28 const real ans2 = REAL(0.04687499995)29 + y*( REAL(-0.2002690873e-3)30 + y*( REAL(0.8449199096e-5)31 + y*( REAL(-0.88228987e-6)32 + y* REAL(0.105787412e-6))));33 realsn,cn;21 const double y = 64.0/(ax*ax); 22 const double xx = ax - 2.356194491; 23 const double ans1 = 1.0 24 + y*(0.183105e-2 25 + y*(-0.3516396496e-4 26 + y*(0.2457520174e-5 27 + y*-0.240337019e-6))); 28 const double ans2 = 0.04687499995 29 + y*(-0.2002690873e-3 30 + y*(0.8449199096e-5 31 + y*(-0.88228987e-6 32 + y*0.105787412e-6))); 33 double sn,cn; 34 34 SINCOS(xx, sn, cn); 35 const real ans = sqrt(REAL(0.636619772)/ax) * (cn*ans1 - (REAL(8.0)/ax)*sn*ans2);36 return (x < REAL(0.0)) ? -ans : ans;35 const double ans = sqrt(0.636619772/ax) * (cn*ans1 - (8.0/ax)*sn*ans2); 36 return (x < 0.0) ? -ans : ans; 37 37 } 38 38 }
Note: See TracChangeset
for help on using the changeset viewer.