Fixed namespace clash (stderr)
[pspp-builds.git] / src / misc.h
index d8d197022e0453382cf84f4554c868f453729400..26b9a52639b3cafb7088e3c9690f132cc65cb99d 100644 (file)
 #if !math_misc_h
 #define math_misc_h 1
 
+#include <float.h>
 #include <math.h>
 
+#define EPSILON (10 * DBL_EPSILON)
+
 /* HUGE_VAL is traditionally defined as positive infinity, or
    alternatively, DBL_MAX. */
 #if !HAVE_ISINF
 
 int intlog10 (unsigned);
 
+/* Returns the square of X. */
+static inline double
+pow2 (double x) 
+{
+  return x * x;
+}
+
+/* Returns the cube of X. */
+static inline double
+pow3 (double x) 
+{
+  return x * x * x;
+}
+
+/* Returns the fourth power of X. */
+static inline double
+pow4 (double x) 
+{
+  double y = x * x;
+  y *= y;
+  return y;
+}
+
 #endif /* math/misc.h */