X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fmisc.h;h=26b9a52639b3cafb7088e3c9690f132cc65cb99d;hb=6c4fd1b460040a20ef2d2b71c94adc934dc32767;hp=d8d197022e0453382cf84f4554c868f453729400;hpb=4944c86a9318bc5b5578ab145a95c116ffd2c9fd;p=pspp-builds.git diff --git a/src/misc.h b/src/misc.h index d8d19702..26b9a526 100644 --- a/src/misc.h +++ b/src/misc.h @@ -20,8 +20,11 @@ #if !math_misc_h #define math_misc_h 1 +#include #include +#define EPSILON (10 * DBL_EPSILON) + /* HUGE_VAL is traditionally defined as positive infinity, or alternatively, DBL_MAX. */ #if !HAVE_ISINF @@ -105,4 +108,27 @@ 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 */