X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fmisc.h;h=26b9a52639b3cafb7088e3c9690f132cc65cb99d;hb=067d02c2b8c591efc368cf5127c497313d7a373f;hp=0f03b6df2df9dba6a9779efced19e12d3728b991;hpb=60d7d619ee7885ad065f178eb0cf1e5d432b1921;p=pspp diff --git a/src/misc.h b/src/misc.h index 0f03b6df2d..26b9a52639 100644 --- a/src/misc.h +++ b/src/misc.h @@ -108,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 */