summaryrefslogtreecommitdiffstats
path: root/libdimension/dimension
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2011-10-28 15:46:30 -0400
committerTavian Barnes <tavianator@gmail.com>2011-10-31 23:22:02 -0400
commit2e77183461e11521a37f34e0c01581df762413fc (patch)
tree9bf1cbabee73c4f0ea2cba878138bb90704b6ba5 /libdimension/dimension
parent6aafcec6823d2b99c40b2ce85ed6581b6c3af3ea (diff)
downloaddimension-2e77183461e11521a37f34e0c01581df762413fc.tar.xz
Use Rouillier and Zimmerman's version of the Uspensky algorithm.
Diffstat (limited to 'libdimension/dimension')
-rw-r--r--libdimension/dimension/geometry.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/libdimension/dimension/geometry.h b/libdimension/dimension/geometry.h
index d2ad362..1248e01 100644
--- a/libdimension/dimension/geometry.h
+++ b/libdimension/dimension/geometry.h
@@ -124,12 +124,17 @@ dmnsn_degrees(double radians)
return radians*45.0/atan(1.0);
}
-/** Return the sign bit of a scalar. */
+/** Return the sign of a scalar. */
DMNSN_INLINE int
-dmnsn_signbit(double n)
+dmnsn_sign(double n)
{
- /* Guarantee a 1 or 0 return, to allow testing two signs for equality */
- return signbit(n) ? 1 : 0;
+ if (n > 0.0) {
+ return 1;
+ } else if (n < 0.0) {
+ return -1;
+ } else {
+ return 0;
+ }
}
/* Shorthand for vector/matrix construction */