15 #if !defined(_WIN32) && !defined(VXWORKS)
16 #include <sys/param.h>
24 #ifdef DtUSE_UTILITIES_NAMESPACE
25 namespace DtUSE_UTILITIES_NAMESPACE
31 #define DtEPico 1.0E-12
32 #define DtENano 1.0E-09
33 #define DtEMicro 1.0E-06
34 #define DtEMilli 1.0E-03
35 #define DtECenti 1.0E-02
36 #define DtEDeci 1.0E-01
37 #define DtEHalf 5.0E-01
38 #define DtENineTenths 9.0E-01
40 #define DtEDeca 1.0E01
41 #define DtEHecto 1.0E02
42 #define DtEKilo 1.0E03
43 #define DtEMega 1.0E06
44 #define DtEGiga 1.0E09
47 #define DtEq(x, y, e) ((DtAbs((x) - (y)) <= (e)) ? true : false)
49 #define M_2PI 6.28318530717958647693
52 #define M_E 2.7182818284590452354
53 #define M_1_E 0.36787944117144232160
54 #define M_LN2 0.69314718055994530942
55 #define M_LN10 2.30258509299404568402
56 #define M_LOG2E 1.4426950408889634074
57 #define M_LOG10E 0.43429448190325182765
58 #define M_PI 3.14159265358979323846
59 #define M_PI_2 1.57079632679489661923
60 #define M_PI_3 1.04719755119659774615
61 #define M_PI_4 0.78539816339744830962
62 #define M_1_PI 0.31830988618379067154
63 #define M_2_PI 0.63661977236758134308
64 #define M_3_PI 0.954929658551372014613
65 #define M_4_PI 1.27323954473516268615
66 #define M_SQRTPI 1.77245385090551602730
67 #define M_1_SQRTPI 0.564189583547756286948
68 #define M_2_SQRTPI 1.12837916709551257390
69 #define M_3_SQRTPI 1.69256875064326886084
70 #define M_4_SQRTPI 2.25675833419102514779
71 #define M_SQRT2PI 2.50662827463100050242
72 #define M_1_SQRT2PI 0.39894228040143267794
73 #define M_RAD2DEG 57.2957795130823208768
74 #define M_DEG2RAD 0.0174532925199432957692
75 #define M_SQRT2 1.41421356237309504880
76 #define M_SQRT_2 0.707106781186547524401
77 #define M_GOLDEN_R 0.6180339887498948482046
83 return ((rad /
M_PI) * 180.0);
89 return ((deg *
M_PI) / 180.0);
96 return (((x) >= 0) ? (x) : (-(x)));
103 return (((x) >= 0) ? 1 : -1);
110 return (((x) >= 0) ? (x) : 0);
114 template <
typename T>
117 if (val >= 0)
return 0;
122 template <
typename T>
129 template <
typename T>
149 template <
typename T>
157 inline float DtMod(
float a,
float b)
159 return (
float)fmod((
float)a,(
float)b);
164 inline double DtMod(
double a,
double b)
170 template <
typename T>
178 if( a == 0 )
return b;
180 if( b == 0 )
return a;
185 template <
typename T>
190 return (a * b) /
DtGCD(a,b);
193 #ifdef DtUSE_UTILITIES_NAMESPACE
This file declares vlException.
T DtSquare(const T &val)
Returns the square of x for type T.
Definition: vlMath.h:123
double DtRad2Deg(double rad)
Converts Radians to Degrees.
Definition: vlMath.h:81
A Templated version of DtException.
Definition: vlExceptions.h:95
int DtSgn(T x)
Returns the sign of X for type T.
Definition: vlMath.h:101
T DtLimit(T x, T lo, T hi)
if x is outside the limits (hi and lo) then x is set to the nearest limit
Definition: vlMath.h:130
T DtGCD(T a, T b)
Returns the greatest common divisor of a and b for type T.
Definition: vlMath.h:171
#define DtTHROW_NEW(exceptionClass, errorMsg)
Throws a new DtException using the class name and the error message.
Definition: vlExceptions.h:164
#define DT_DLL_MATRIX
Definition: vlMachineTypes.h:107
T DtNeg(const T &val)
Returns x if x is less than zero for type T.
Definition: vlMath.h:115
T DtLCM(T a, T b)
Returns the least common multiple of a and b for Type T.
Definition: vlMath.h:186
T DtPos(T x)
Returns x if greater than zero.
Definition: vlMath.h:108
double DtDeg2Rad(double deg)
Converts Degrees to Radians.
Definition: vlMath.h:87
#define M_PI
Definition: vlMath.h:58
T DtMod(T a, T b)
Returns the remainder of a / b for type T.
Definition: vlMath.h:150
T DtAbs(T x)
Returns the absolute value of x for type T.
Definition: vlMath.h:94
This file contains typedefs for machine dependant types.