--- a/src/basics.h Fri Mar 03 00:35:43 2017 +0200
+++ b/src/basics.h Fri Mar 03 23:08:04 2017 +0200
@@ -315,3 +315,15 @@
{
return ring.size();
}
+
+/*
+ * Extracts the sign of x.
+ */
+template<typename T>
+T sign(T x)
+{
+ if (isZero(x))
+ return {};
+ else
+ return x / qAbs(x);
+}