core_shell_microgelscostrafo411magnetic_modelrelease_v0.94release_v0.95ticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change
on this file since a776125 was
994d77f,
checked in by Paul Kienzle <pkienzle@…>, 10 years ago
|
Convert double to float rather than using real
|
-
Property mode set to
100644
|
File size:
1.1 KB
|
Rev | Line | |
---|
[994d77f] | 1 | double J1(double x); |
---|
| 2 | double J1(double x) |
---|
[14de349] | 3 | { |
---|
[994d77f] | 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 |
---|
[14de349] | 18 | + y)))); |
---|
| 19 | return ans1/ans2; |
---|
| 20 | } else { |
---|
[994d77f] | 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; |
---|
[14de349] | 34 | SINCOS(xx, sn, cn); |
---|
[994d77f] | 35 | const double ans = sqrt(0.636619772/ax) * (cn*ans1 - (8.0/ax)*sn*ans2); |
---|
| 36 | return (x < 0.0) ? -ans : ans; |
---|
[14de349] | 37 | } |
---|
| 38 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.