Changeset 960cd80 in sasmodels


Ignore:
Timestamp:
Feb 26, 2016 9:09:06 AM (8 years ago)
Author:
Paul Kienzle <pkienzle@…>
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
Message:

code reformatting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/kernel_template.c

    r718514b r960cd80  
    1212#ifndef USE_OPENCL 
    1313#  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) 
    1818         #include <limits> 
    1919         #include <float.h> 
    2020         #define kernel extern "C" __declspec( dllexport ) 
    2121         inline double trunc(double x) { return x>=0?floor(x):-floor(-x); } 
    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 
     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 
    5050     #else 
    5151         #define kernel extern "C" 
Note: See TracChangeset for help on using the changeset viewer.