about summary refs log tree commit diff
path: root/math
diff options
context:
space:
mode:
Diffstat (limited to 'math')
-rwxr-xr-xmath/gen-libm-test.pl4
-rw-r--r--math/libm-test.inc160
2 files changed, 162 insertions, 2 deletions
diff --git a/math/gen-libm-test.pl b/math/gen-libm-test.pl
index 67227c46f5..642fc98214 100755
--- a/math/gen-libm-test.pl
+++ b/math/gen-libm-test.pl
@@ -320,7 +320,9 @@ sub parse_args {
   }
   # Special handling for some macros:
   $cline .= " (\"$str\", ";
-  if ($args[0] =~ /fpclassify|isnormal|isfinite|isinf|isnan|signbit/) {
+  if ($args[0] =~ /fpclassify|isnormal|isfinite|isinf|isnan|signbit
+      |isgreater|isgreaterequal|isless|islessequal
+      |islessgreater|isunordered/x) {
     $c_call = "$args[0] (";
   } else {
     $c_call = " FUNC($args[0]) (";
diff --git a/math/libm-test.inc b/math/libm-test.inc
index 2562bb124a..0422e8e8b4 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -43,6 +43,7 @@
    fabs, fdim, finite, floor, fma, fmax, fmin, fmod, fpclassify,
    frexp, gamma, hypot,
    ilogb, isfinite, isinf, isnan, isnormal,
+   isless, islessequal, isgreater, isgreaterequal, islessgreater, isunordered,
    j0, j1, jn,
    ldexp, lgamma, log, log10, log1p, log2, logb,
    modf, nearbyint, nextafter, nexttoward,
@@ -58,7 +59,6 @@
 
    At the moment the following functions and macros aren't tested:
    drem (alias for remainder),
-   isless, islessequal, isgreater, isgreaterequal, islessgreater, isunordered,
    lgamma_r,
    nan,
    pow10 (alias for exp10).
@@ -5138,6 +5138,56 @@ isfinite_test (void)
 }
 
 static void
+isgreater_test (void)
+{
+  START (isgreater);
+
+  TEST_ff_i (isgreater, minus_zero, minus_zero, 0);
+  TEST_ff_i (isgreater, minus_zero, plus_zero, 0);
+  TEST_ff_i (isgreater, minus_zero, (FLOAT) 1, 0);
+  TEST_ff_i (isgreater, minus_zero, nan_value, 0);
+  TEST_ff_i (isgreater, plus_zero, minus_zero, 0);
+  TEST_ff_i (isgreater, plus_zero, plus_zero, 0);
+  TEST_ff_i (isgreater, plus_zero, (FLOAT) 1, 0);
+  TEST_ff_i (isgreater, plus_zero, nan_value, 0);
+  TEST_ff_i (isgreater, (FLOAT) 1, minus_zero, 1);
+  TEST_ff_i (isgreater, (FLOAT) 1, plus_zero, 1);
+  TEST_ff_i (isgreater, (FLOAT) 1, (FLOAT) 1, 0);
+  TEST_ff_i (isgreater, (FLOAT) 1, nan_value, 0);
+  TEST_ff_i (isgreater, nan_value, minus_zero, 0);
+  TEST_ff_i (isgreater, nan_value, plus_zero, 0);
+  TEST_ff_i (isgreater, nan_value, (FLOAT) 1, 0);
+  TEST_ff_i (isgreater, nan_value, nan_value, 0);
+
+  END (isgreater);
+}
+
+static void
+isgreaterequal_test (void)
+{
+  START (isgreaterequal);
+
+  TEST_ff_i (isgreaterequal, minus_zero, minus_zero, 1);
+  TEST_ff_i (isgreaterequal, minus_zero, plus_zero, 1);
+  TEST_ff_i (isgreaterequal, minus_zero, (FLOAT) 1, 0);
+  TEST_ff_i (isgreaterequal, minus_zero, nan_value, 0);
+  TEST_ff_i (isgreaterequal, plus_zero, minus_zero, 1);
+  TEST_ff_i (isgreaterequal, plus_zero, plus_zero, 1);
+  TEST_ff_i (isgreaterequal, plus_zero, (FLOAT) 1, 0);
+  TEST_ff_i (isgreaterequal, plus_zero, nan_value, 0);
+  TEST_ff_i (isgreaterequal, (FLOAT) 1, minus_zero, 1);
+  TEST_ff_i (isgreaterequal, (FLOAT) 1, plus_zero, 1);
+  TEST_ff_i (isgreaterequal, (FLOAT) 1, (FLOAT) 1, 1);
+  TEST_ff_i (isgreaterequal, (FLOAT) 1, nan_value, 0);
+  TEST_ff_i (isgreaterequal, nan_value, minus_zero, 0);
+  TEST_ff_i (isgreaterequal, nan_value, plus_zero, 0);
+  TEST_ff_i (isgreaterequal, nan_value, (FLOAT) 1, 0);
+  TEST_ff_i (isgreaterequal, nan_value, nan_value, 0);
+
+  END (isgreaterequal);
+}
+
+static void
 isinf_test (void)
 {
   START (isinf);
@@ -5154,6 +5204,81 @@ isinf_test (void)
 }
 
 static void
+isless_test (void)
+{
+  START (isless);
+
+  TEST_ff_i (isless, minus_zero, minus_zero, 0);
+  TEST_ff_i (isless, minus_zero, plus_zero, 0);
+  TEST_ff_i (isless, minus_zero, (FLOAT) 1, 1);
+  TEST_ff_i (isless, minus_zero, nan_value, 0);
+  TEST_ff_i (isless, plus_zero, minus_zero, 0);
+  TEST_ff_i (isless, plus_zero, plus_zero, 0);
+  TEST_ff_i (isless, plus_zero, (FLOAT) 1, 1);
+  TEST_ff_i (isless, plus_zero, nan_value, 0);
+  TEST_ff_i (isless, (FLOAT) 1, minus_zero, 0);
+  TEST_ff_i (isless, (FLOAT) 1, plus_zero, 0);
+  TEST_ff_i (isless, (FLOAT) 1, (FLOAT) 1, 0);
+  TEST_ff_i (isless, (FLOAT) 1, nan_value, 0);
+  TEST_ff_i (isless, nan_value, minus_zero, 0);
+  TEST_ff_i (isless, nan_value, plus_zero, 0);
+  TEST_ff_i (isless, nan_value, (FLOAT) 1, 0);
+  TEST_ff_i (isless, nan_value, nan_value, 0);
+
+  END (isless);
+}
+
+static void
+islessequal_test (void)
+{
+  START (islessequal);
+
+  TEST_ff_i (islessequal, minus_zero, minus_zero, 1);
+  TEST_ff_i (islessequal, minus_zero, plus_zero, 1);
+  TEST_ff_i (islessequal, minus_zero, (FLOAT) 1, 1);
+  TEST_ff_i (islessequal, minus_zero, nan_value, 0);
+  TEST_ff_i (islessequal, plus_zero, minus_zero, 1);
+  TEST_ff_i (islessequal, plus_zero, plus_zero, 1);
+  TEST_ff_i (islessequal, plus_zero, (FLOAT) 1, 1);
+  TEST_ff_i (islessequal, plus_zero, nan_value, 0);
+  TEST_ff_i (islessequal, (FLOAT) 1, minus_zero, 0);
+  TEST_ff_i (islessequal, (FLOAT) 1, plus_zero, 0);
+  TEST_ff_i (islessequal, (FLOAT) 1, (FLOAT) 1, 1);
+  TEST_ff_i (islessequal, (FLOAT) 1, nan_value, 0);
+  TEST_ff_i (islessequal, nan_value, minus_zero, 0);
+  TEST_ff_i (islessequal, nan_value, plus_zero, 0);
+  TEST_ff_i (islessequal, nan_value, (FLOAT) 1, 0);
+  TEST_ff_i (islessequal, nan_value, nan_value, 0);
+
+  END (islessequal);
+}
+
+static void
+islessgreater_test (void)
+{
+  START (islessgreater);
+
+  TEST_ff_i (islessgreater, minus_zero, minus_zero, 0);
+  TEST_ff_i (islessgreater, minus_zero, plus_zero, 0);
+  TEST_ff_i (islessgreater, minus_zero, (FLOAT) 1, 1);
+  TEST_ff_i (islessgreater, minus_zero, nan_value, 0);
+  TEST_ff_i (islessgreater, plus_zero, minus_zero, 0);
+  TEST_ff_i (islessgreater, plus_zero, plus_zero, 0);
+  TEST_ff_i (islessgreater, plus_zero, (FLOAT) 1, 1);
+  TEST_ff_i (islessgreater, plus_zero, nan_value, 0);
+  TEST_ff_i (islessgreater, (FLOAT) 1, minus_zero, 1);
+  TEST_ff_i (islessgreater, (FLOAT) 1, plus_zero, 1);
+  TEST_ff_i (islessgreater, (FLOAT) 1, (FLOAT) 1, 0);
+  TEST_ff_i (islessgreater, (FLOAT) 1, nan_value, 0);
+  TEST_ff_i (islessgreater, nan_value, minus_zero, 0);
+  TEST_ff_i (islessgreater, nan_value, plus_zero, 0);
+  TEST_ff_i (islessgreater, nan_value, (FLOAT) 1, 0);
+  TEST_ff_i (islessgreater, nan_value, nan_value, 0);
+
+  END (islessgreater);
+}
+
+static void
 isnan_test (void)
 {
   START (isnan);
@@ -5186,6 +5311,31 @@ isnormal_test (void)
 }
 
 static void
+isunordered_test (void)
+{
+  START (isunordered);
+
+  TEST_ff_i (isunordered, minus_zero, minus_zero, 0);
+  TEST_ff_i (isunordered, minus_zero, plus_zero, 0);
+  TEST_ff_i (isunordered, minus_zero, (FLOAT) 1, 0);
+  TEST_ff_i (isunordered, minus_zero, nan_value, 1);
+  TEST_ff_i (isunordered, plus_zero, minus_zero, 0);
+  TEST_ff_i (isunordered, plus_zero, plus_zero, 0);
+  TEST_ff_i (isunordered, plus_zero, (FLOAT) 1, 0);
+  TEST_ff_i (isunordered, plus_zero, nan_value, 1);
+  TEST_ff_i (isunordered, (FLOAT) 1, minus_zero, 0);
+  TEST_ff_i (isunordered, (FLOAT) 1, plus_zero, 0);
+  TEST_ff_i (isunordered, (FLOAT) 1, (FLOAT) 1, 0);
+  TEST_ff_i (isunordered, (FLOAT) 1, nan_value, 1);
+  TEST_ff_i (isunordered, nan_value, minus_zero, 1);
+  TEST_ff_i (isunordered, nan_value, plus_zero, 1);
+  TEST_ff_i (isunordered, nan_value, (FLOAT) 1, 1);
+  TEST_ff_i (isunordered, nan_value, nan_value, 1);
+
+  END (isunordered);
+}
+
+static void
 j0_test (void)
 {
   FLOAT s, c;
@@ -9818,6 +9968,14 @@ main (int argc, char **argv)
   fma_test_downward ();
   fma_test_upward ();
 
+  /* Comparison macros:  */
+  isgreater_test ();
+  isgreaterequal_test ();
+  isless_test ();
+  islessequal_test ();
+  islessgreater_test ();
+  isunordered_test ();
+
   /* Complex functions:  */
   cabs_test ();
   cacos_test ();