strtoumax: fix typo in previous commit.
[gnulib.git] / tests / test-frexp.h
index 3ea52b9..e50be14 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of splitting a double into fraction and mantissa.
-   Copyright (C) 2012 Free Software Foundation, Inc.
+   Copyright (C) 2012-2013 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -165,4 +165,15 @@ test_function (void)
       ASSERT (mantissa < L_(1.0));
       ASSERT (mantissa == my_ldexp (x, - exp));
     }
+
+  /* Randomized tests.  */
+  for (i = 0; i < SIZEOF (RANDOM); i++)
+    {
+      x = L_(20.0) * RANDOM[i] - L_(10.0); /* -10.0 <= x <= 10.0 */
+      {
+        int exp = -9999;
+        DOUBLE mantissa = FREXP (x, &exp);
+        ASSERT (x == my_ldexp (mantissa, exp));
+      }
+    }
 }