unigbrk: New modules for grapheme clusters.
[pspp] / tests / test-roundl-ieee.c
index ca4ac9ed7e5aa6ac8113f844e1ca09ecccdd9ad0..431005bae22dea8cea96b5969ece7b7cedb6965e 100644 (file)
@@ -30,9 +30,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 (roundl (0.0L)));
   ASSERT (!!signbit (roundl (minus_zerol)) == !!signbit (minus_zerol));
+  /* Positive numbers.  */
+  ASSERT (!signbit (roundl (0.3L)));
+  ASSERT (!signbit (roundl (0.7L)));
+  /* Negative numbers.  */
+  ASSERT (!!signbit (roundl (-0.3L)) == !!signbit (minus_zerol));
+  ASSERT (!!signbit (roundl (-0.7L)) == !!signbit (minus_zerol));
 
   return 0;
 }