chiark / gitweb /
reorganisation is complete, need to implement various things, make it compile, etc.
[moebius2.git] / common.h
diff --git a/common.h b/common.h
new file mode 100644 (file)
index 0000000..1a358d1
--- /dev/null
+++ b/common.h
@@ -0,0 +1,23 @@
+/*
+ * Generally useful stuff.
+ */
+
+#ifndef COMMON_H
+#define COMMON_H
+
+#define _GNU_SOURCE
+#include <math.h>
+#include <limits.h>
+
+double hypotD(const double p[D3], const double q[D3]);
+double hypotD2(const double p[D3], const double q[D3]);
+double hypotD2plus(const double p[D3], const double q[D3], double add);
+
+#ifdef FP_FAST_FMA
+# define fma_fast fma
+#else
+# define fma_fast(f1,f2,t) ((f1)*(f2)+(t))
+#endif
+#define ffsqa(factor,term) fma_fast((factor),(factor),(term))
+
+#endif /*COMMON_H*/