unigbrk: New modules for grapheme clusters.
[pspp] / tests / test-truncl-ieee.c
index de6c9adf0b0bcbf6c49965b6eb78395d418a197d..173c1ae1a6ea4ca30214ea2e2b5996a3948c5e34 100644 (file)
@@ -29,9 +29,20 @@ main ()
 
   BEGIN_LONG_DOUBLE_ROUNDING ();
 
+  /* See IEEE 754, section 6.3:
+       "the sign of the result of the round floating-point number to
+        integral value operation is the sign of the operand. These rules
+        shall apply even when operands or results are zero or infinite."  */
+
   /* Zero.  */
   ASSERT (!signbit (truncl (0.0L)));
   ASSERT (!!signbit (truncl (minus_zerol)) == !!signbit (minus_zerol));
+  /* Positive numbers.  */
+  ASSERT (!signbit (truncl (0.3L)));
+  ASSERT (!signbit (truncl (0.7L)));
+  /* Negative numbers.  */
+  ASSERT (!!signbit (truncl (-0.3L)) == !!signbit (minus_zerol));
+  ASSERT (!!signbit (truncl (-0.7L)) == !!signbit (minus_zerol));
 
   return 0;
 }