13 #include "qwt_global.h" 
   23 #ifndef _USE_MATH_DEFINES 
   24 #define _USE_MATH_DEFINES 
   25 #define undef_USE_MATH_DEFINES 
   30 #ifdef undef_USE_MATH_DEFINES 
   31 #undef _USE_MATH_DEFINES 
   32 #undef undef_USE_MATH_DEFINES 
   36 #define M_E ( 2.7182818284590452354 ) 
   40 #define M_LOG2E ( 1.4426950408889634074 ) 
   44 #define M_LOG10E ( 0.43429448190325182765 ) 
   48 #define M_LN2 ( 0.69314718055994530942 ) 
   52 #define M_LN10 ( 2.30258509299404568402 ) 
   56 #define M_PI ( 3.14159265358979323846 ) 
   60 #define M_PI_2 ( 1.57079632679489661923 ) 
   64 #define M_PI_4 ( 0.78539816339744830962 ) 
   68 #define M_1_PI ( 0.31830988618379067154 ) 
   72 #define M_2_PI ( 0.63661977236758134308 ) 
   76 #define M_2_SQRTPI ( 1.12837916709551257390 ) 
   80 #define M_SQRT2 ( 1.41421356237309504880 ) 
   84 #define M_SQRT1_2 ( 0.70710678118654752440 ) 
   87 #if defined( QT_WARNING_PUSH ) 
   93     QT_WARNING_DISABLE_CLANG(
"-Wdouble-promotion")
 
   94     QT_WARNING_DISABLE_GCC("-Wdouble-promotion")
 
  103 QWT_CONSTEXPR 
inline float qwtMinF( 
float a, 
float b )
 
  105     return ( a < b ) ? a : b;
 
  109 QWT_CONSTEXPR 
inline double qwtMinF( 
double a, 
double b )
 
  111     return ( a < b ) ? a : b;
 
  115 QWT_CONSTEXPR 
inline qreal qwtMinF( 
float a, 
double b )
 
  117     return ( a < b ) ? a : b;
 
  121 QWT_CONSTEXPR 
inline qreal qwtMinF( 
double a, 
float b )
 
  123     return ( a < b ) ? a : b;
 
  127 QWT_CONSTEXPR 
inline float qwtMaxF( 
float a, 
float b )
 
  129     return ( a < b ) ? b : a;
 
  133 QWT_CONSTEXPR 
inline double qwtMaxF( 
double a, 
double b )
 
  135     return ( a < b ) ? b : a;
 
  139 QWT_CONSTEXPR 
inline qreal qwtMaxF( 
float a, 
double b )
 
  141     return ( a < b ) ? b : a;
 
  145 QWT_CONSTEXPR 
inline qreal qwtMaxF( 
double a, 
float b )
 
  147     return ( a < b ) ? b : a;
 
  150 #if defined( QT_WARNING_POP ) 
  154 QWT_EXPORT 
double qwtNormalizeRadians( 
double radians );
 
  155 QWT_EXPORT 
double qwtNormalizeDegrees( 
double degrees );
 
  156 QWT_EXPORT quint32 qwtRand();
 
  170 inline int qwtFuzzyCompare( 
double value1, 
double value2, 
double intervalSize )
 
  172     const double eps = qAbs( 1.0e-6 * intervalSize );
 
  174     if ( value2 - value1 > eps )
 
  177     if ( value1 - value2 > eps )
 
  184 inline int qwtSign( 
double x )
 
  195 inline double qwtSqr( 
double x )
 
  201 inline double qwtFastAtan( 
double x )
 
  204         return -M_PI_2 - x / ( x * x + 0.28 );
 
  207         return M_PI_2 - x / ( x * x + 0.28 );
 
  209     return x / ( 1.0 + x * x * 0.28 );
 
  213 inline double qwtFastAtan2( 
double y, 
double x )
 
  216         return qwtFastAtan( y / x );
 
  220         const double d = qwtFastAtan( y / x );
 
  221         return ( y >= 0 ) ? d + M_PI : d - M_PI;
 
  244 inline double qwtCubicPolynomial( 
double x,
 
  245     double a, 
double b, 
double c, 
double d )
 
  247     return ( ( ( a * x ) + b ) * x + c ) * x + d;
 
  251 inline double qwtRadians( 
double degrees )
 
  253     return degrees * M_PI / 180.0;
 
  257 inline double qwtDegrees( 
double degrees )
 
  259     return degrees * 180.0 / M_PI;
 
  266 inline int qwtCeil( qreal value )
 
  269     return int( ceil( value ) );
 
  275 inline int qwtFloor( qreal value )
 
  278     return int( floor( value ) );