summaryrefslogtreecommitdiff
path: root/math.h
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2015-10-30 10:34:38 +0100
committerLars-Dominik Braun <lars@6xq.net>2015-10-30 10:34:38 +0100
commit29206df7b398c450fe29b5f23bbc3d29e69006b5 (patch)
tree853102673d31ec101d0cf6cb4c56421e23ba69b7 /math.h
parentc1c5f4787820e7b20c702ed288c8b3b1ccb6a2fc (diff)
downloadpucket-29206df7b398c450fe29b5f23bbc3d29e69006b5.tar.gz
pucket-29206df7b398c450fe29b5f23bbc3d29e69006b5.tar.bz2
pucket-29206df7b398c450fe29b5f23bbc3d29e69006b5.zip
Import asteria from jwildfire
Diffstat (limited to 'math.h')
-rw-r--r--math.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/math.h b/math.h
index 48519b4..c29e427 100644
--- a/math.h
+++ b/math.h
@@ -109,6 +109,18 @@ inline double sum(const double2 in) {
return in[0] + in[1];
}
+inline double square (const double in) {
+ return in * in;
+}
+
+inline double2 square_d2 (const double2 in) {
+ return in * in;
+}
+
+inline double squaresum (const double2 in) {
+ return sum (square_d2 (in));
+}
+
inline void normalize (double * const a, const size_t n) {
double sum = 0.0;
for (unsigned int j = 0; j < n; j++) {