25 #ifndef MATH_EXTENSION_HH
26 #define MATH_EXTENSION_HH
50 #define MIN(a, b) (((a) < (b)) ? (a) : (b))
54 #define MAX(a, b) (((a) > (b)) ? (a) : (b))
58 #define M_PI (3.141592653589793238462643383279)
100 static const int NB_FUNCTION_TYPES = 6;
113 inline int sqr(
int AValue)
115 return AValue*AValue;
118 inline float sqr(
float AValue)
120 return AValue*AValue;
123 inline double sqr(
double AValue)
125 return AValue*AValue;
175 return AValue<0 ? -1 : +1;
188 assert(-1 <= ASign1 && ASign1 <= +1);
189 assert(-1 <= ASign2 && ASign2 <= +1);
191 if (ASign1==0 || ASign2==0)
194 return ASign1==ASign2 ? +1 : -1;
207 return AValue1 +
EPSILON < AValue2;
219 return fabs(AValue1 - AValue2) <
EPSILON;
230 return AAngle/
M_PI*180.0;
241 return AAngle*
M_PI/180.0;
252 return sin(
rad(AAngle));
263 return cos(
rad(AAngle));
274 return tan(
rad(AAngle));
285 return deg(asin(AValue));
296 return deg(acos(AValue));
307 return deg(atan(AValue));
342 do { angle += 360; }
while (angle<0);
374 return dAtan(Ay/Ax)+180.0;
392 inline int pgcd(
int Ax,
int Ay)
416 #endif // MATH_EXTENSION_HH