9 static T pi() { return T(3.1415926535897932384626433832795029L); }
10 static T min(const T& a, const T& b)
11 { return a < b ? a : b; }
12 static T min(const T& a, const T& b, const T& c)
13 { return min(min(a, b), c); }
14 static T min(const T& a, const T& b, const T& c, const T& d)
15 { return min(min(min(a, b), c), d); }
16 static T max(const T& a, const T& b)
17 { return a > b ? a : b; }
18 static T max(const T& a, const T& b, const T& c)
19 { return max(max(a, b), c); }
20 static T max(const T& a, const T& b, const T& c, const T& d)
21 { return max(max(max(a, b), c), d); }
22 static int sign(const T& a)
24 if (a < -SGLimits<T>::min())
26 else if (SGLimits<T>::min() < a)
33 /// Returns true if v is a NaN value
34 /// Use with care: allways code that you do not need to use that!
35 static bool isNaN(const T& v)
39 #elif defined HAVE_STD_ISNAN
42 // Use that every compare involving a NaN returns false
43 // But be careful, some usual compiler switches like for example
44 // -fast-math from gcc might optimize that expression to v != v which
45 // behaves exactly like the opposite ...
52 typedef SGMisc<float> SGMiscf;
53 typedef SGMisc<double> SGMiscd;