Changeset 960cd80 in sasmodels
- Timestamp:
- Feb 26, 2016 9:09:06 AM (9 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:
- 3a45c2c
- Parents:
- a98a2cf
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/kernel_template.c
r718514b r960cd80 12 12 #ifndef USE_OPENCL 13 13 # ifdef __cplusplus 14 #include <cstdio>15 #include <cmath>16 using namespace std;17 #if defined(_MSC_VER)14 #include <cstdio> 15 #include <cmath> 16 using namespace std; 17 #if defined(_MSC_VER) 18 18 #include <limits> 19 19 #include <float.h> 20 20 #define kernel extern "C" __declspec( dllexport ) 21 21 inline double trunc(double x) { return x>=0?floor(x):-floor(-x); } 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 22 inline double fmin(double x, double y) { return x>y ? y : x; } 23 inline double fmax(double x, double y) { return x<y ? y : x; } 24 inline double isnan(double x) { return _isnan(x); } 25 #define NAN (std::numeric_limits<double>::quiet_NaN()) // non-signalling NaN 26 static double cephes_expm1(double x) { 27 // Adapted from the cephes math library. 28 // Copyright 1984 - 1992 by Stephen L. Moshier 29 if (x != x || x == 0.0) { 30 return x; // NaN and +/- 0 31 } else if (x < -0.5 || x > 0.5) { 32 return exp(x) - 1.0; 33 } else { 34 const double xsq = x*x; 35 const double p = ((( 36 +1.2617719307481059087798E-4)*xsq 37 +3.0299440770744196129956E-2)*xsq 38 +9.9999999999999999991025E-1); 39 const double q = (((( 40 +3.0019850513866445504159E-6)*xsq 41 +2.5244834034968410419224E-3)*xsq 42 +2.2726554820815502876593E-1)*xsq 43 +2.0000000000000000000897E0); 44 double r = x * p; 45 r = r / (q - r); 46 return r+r; 47 } 48 } 49 #define expm1 cephes_expm1 50 50 #else 51 51 #define kernel extern "C"
Note: See TracChangeset
for help on using the changeset viewer.