changeset 16557:b0b6262e2d8e

frexp* tests: Refactor. * tests/test-frexp.h: New file, extracted from tests/test-frexpl.c. * tests/test-frexp.c: Include and use it. * tests/test-frexpf.c: Likewise. * tests/test-frexpl.c: Likewise. * modules/frexp-tests (Files): Add tests/test-frexp.h. * modules/frexpf-tests (Files): Likewise. * modules/frexpl-tests (Files): Likewise.
author Bruno Haible <bruno@clisp.org>
date Sat, 03 Mar 2012 13:35:37 +0100
parents 25b84e0d96a6
children 74e0aeb8a7cc
files ChangeLog modules/frexp-tests modules/frexpf-tests modules/frexpl-tests tests/test-frexp.c tests/test-frexp.h tests/test-frexpf.c tests/test-frexpl.c
diffstat 8 files changed, 234 insertions(+), 446 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2012-03-03  Bruno Haible  <bruno@clisp.org>
+
+	frexp* tests: Refactor.
+	* tests/test-frexp.h: New file, extracted from tests/test-frexpl.c.
+	* tests/test-frexp.c: Include and use it.
+	* tests/test-frexpf.c: Likewise.
+	* tests/test-frexpl.c: Likewise.
+	* modules/frexp-tests (Files): Add tests/test-frexp.h.
+	* modules/frexpf-tests (Files): Likewise.
+	* modules/frexpl-tests (Files): Likewise.
+
 2012-03-02  Jim Meyering  <meyering@redhat.com>
 
 	maint: don't specify XZ_OPT=-9ev in dist-related rule
--- a/modules/frexp-tests
+++ b/modules/frexp-tests
@@ -1,5 +1,6 @@
 Files:
 tests/test-frexp.c
+tests/test-frexp.h
 tests/minus-zero.h
 tests/infinity.h
 tests/nan.h
--- a/modules/frexpf-tests
+++ b/modules/frexpf-tests
@@ -1,5 +1,6 @@
 Files:
 tests/test-frexpf.c
+tests/test-frexp.h
 tests/minus-zero.h
 tests/infinity.h
 tests/nan.h
--- a/modules/frexpl-tests
+++ b/modules/frexpl-tests
@@ -1,5 +1,6 @@
 Files:
 tests/test-frexpl.c
+tests/test-frexp.h
 tests/minus-zero.h
 tests/infinity.h
 tests/nan.h
--- a/tests/test-frexp.c
+++ b/tests/test-frexp.c
@@ -36,162 +36,31 @@
 #undef exp
 #define exp exponent
 
-static double
-my_ldexp (double x, int d)
-{
-  for (; d > 0; d--)
-    x *= 2.0;
-  for (; d < 0; d++)
-    x *= 0.5;
-  return x;
-}
+#undef INFINITY
+#undef NAN
+
+#define DOUBLE double
+/* The use of 'volatile' guarantees that excess precision bits are dropped
+   when dealing with denormalized numbers.  It is necessary on x86 systems
+   where double-floats are not IEEE compliant by default, to avoid that the
+   results become platform and compiler option dependent.  'volatile' is a
+   portable alternative to gcc's -ffloat-store option.  */
+#define VOLATILE volatile
+#define ISNAN isnand
+#define INFINITY Infinityd ()
+#define NAN NaNd ()
+#define L_(literal) literal
+#define MINUS_ZERO minus_zerod
+#define MAX_EXP DBL_MAX_EXP
+#define MIN_EXP DBL_MIN_EXP
+#define MIN_NORMAL_EXP DBL_MIN_EXP
+#define FREXP frexp
+#include "test-frexp.h"
 
 int
 main ()
 {
-  int i;
-  /* The use of 'volatile' guarantees that excess precision bits are dropped
-     when dealing with denormalized numbers.  It is necessary on x86 systems
-     where double-floats are not IEEE compliant by default, to avoid that the
-     results become platform and compiler option dependent.  'volatile' is a
-     portable alternative to gcc's -ffloat-store option.  */
-  volatile double x;
-
-  { /* NaN.  */
-    int exp = -9999;
-    double mantissa;
-    x = NaNd ();
-    mantissa = frexp (x, &exp);
-    ASSERT (isnand (mantissa));
-  }
-
-  { /* Positive infinity.  */
-    int exp = -9999;
-    double mantissa;
-    x = Infinityd ();
-    mantissa = frexp (x, &exp);
-    ASSERT (mantissa == x);
-  }
-
-  { /* Negative infinity.  */
-    int exp = -9999;
-    double mantissa;
-    x = - Infinityd ();
-    mantissa = frexp (x, &exp);
-    ASSERT (mantissa == x);
-  }
-
-  { /* Positive zero.  */
-    int exp = -9999;
-    double mantissa;
-    x = 0.0;
-    mantissa = frexp (x, &exp);
-    ASSERT (exp == 0);
-    ASSERT (mantissa == x);
-    ASSERT (!signbit (mantissa));
-  }
-
-  { /* Negative zero.  */
-    int exp = -9999;
-    double mantissa;
-    x = minus_zerod;
-    mantissa = frexp (x, &exp);
-    ASSERT (exp == 0);
-    ASSERT (mantissa == x);
-    ASSERT (signbit (mantissa));
-  }
-
-  for (i = 1, x = 1.0; i <= DBL_MAX_EXP; i++, x *= 2.0)
-    {
-      int exp = -9999;
-      double mantissa = frexp (x, &exp);
-      ASSERT (exp == i);
-      ASSERT (mantissa == 0.5);
-    }
-  for (i = 1, x = 1.0; i >= DBL_MIN_EXP; i--, x *= 0.5)
-    {
-      int exp = -9999;
-      double mantissa = frexp (x, &exp);
-      ASSERT (exp == i);
-      ASSERT (mantissa == 0.5);
-    }
-  for (; i >= DBL_MIN_EXP - 100 && x > 0.0; i--, x *= 0.5)
-    {
-      int exp = -9999;
-      double mantissa = frexp (x, &exp);
-      ASSERT (exp == i);
-      ASSERT (mantissa == 0.5);
-    }
-
-  for (i = 1, x = -1.0; i <= DBL_MAX_EXP; i++, x *= 2.0)
-    {
-      int exp = -9999;
-      double mantissa = frexp (x, &exp);
-      ASSERT (exp == i);
-      ASSERT (mantissa == -0.5);
-    }
-  for (i = 1, x = -1.0; i >= DBL_MIN_EXP; i--, x *= 0.5)
-    {
-      int exp = -9999;
-      double mantissa = frexp (x, &exp);
-      ASSERT (exp == i);
-      ASSERT (mantissa == -0.5);
-    }
-  for (; i >= DBL_MIN_EXP - 100 && x < 0.0; i--, x *= 0.5)
-    {
-      int exp = -9999;
-      double mantissa = frexp (x, &exp);
-      ASSERT (exp == i);
-      ASSERT (mantissa == -0.5);
-    }
-
-  for (i = 1, x = 1.01; i <= DBL_MAX_EXP; i++, x *= 2.0)
-    {
-      int exp = -9999;
-      double mantissa = frexp (x, &exp);
-      ASSERT (exp == i);
-      ASSERT (mantissa == 0.505);
-    }
-  for (i = 1, x = 1.01; i >= DBL_MIN_EXP; i--, x *= 0.5)
-    {
-      int exp = -9999;
-      double mantissa = frexp (x, &exp);
-      ASSERT (exp == i);
-      ASSERT (mantissa == 0.505);
-    }
-  for (; i >= DBL_MIN_EXP - 100 && x > 0.0; i--, x *= 0.5)
-    {
-      int exp = -9999;
-      double mantissa = frexp (x, &exp);
-      ASSERT (exp == i);
-      ASSERT (mantissa >= 0.5);
-      ASSERT (mantissa < 1.0);
-      ASSERT (mantissa == my_ldexp (x, - exp));
-    }
-
-  for (i = 1, x = 1.73205; i <= DBL_MAX_EXP; i++, x *= 2.0)
-    {
-      int exp = -9999;
-      double mantissa = frexp (x, &exp);
-      ASSERT (exp == i);
-      ASSERT (mantissa == 0.866025);
-    }
-  for (i = 1, x = 1.73205; i >= DBL_MIN_EXP; i--, x *= 0.5)
-    {
-      int exp = -9999;
-      double mantissa = frexp (x, &exp);
-      ASSERT (exp == i);
-      ASSERT (mantissa == 0.866025);
-    }
-  for (; i >= DBL_MIN_EXP - 100 && x > 0.0; i--, x *= 0.5)
-    {
-      int exp = -9999;
-      double mantissa = frexp (x, &exp);
-      ASSERT (exp == i || exp == i + 1);
-      ASSERT (mantissa >= 0.5);
-      ASSERT (mantissa < 1.0);
-      ASSERT (mantissa == my_ldexp (x, - exp));
-    }
+  test_function ();
 
   return 0;
 }
new file mode 100644
--- /dev/null
+++ b/tests/test-frexp.h
@@ -0,0 +1,168 @@
+/* Test of splitting a double into fraction and mantissa.
+   Copyright (C) 2012 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
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+static DOUBLE
+my_ldexp (DOUBLE x, int d)
+{
+  for (; d > 0; d--)
+    x *= L_(2.0);
+  for (; d < 0; d++)
+    x *= L_(0.5);
+  return x;
+}
+
+static void
+test_function (void)
+{
+  int i;
+  VOLATILE DOUBLE x;
+
+  { /* NaN.  */
+    int exp = -9999;
+    DOUBLE mantissa;
+    x = NAN;
+    mantissa = FREXP (x, &exp);
+    ASSERT (ISNAN (mantissa));
+  }
+
+  { /* Positive infinity.  */
+    int exp = -9999;
+    DOUBLE mantissa;
+    x = INFINITY;
+    mantissa = FREXP (x, &exp);
+    ASSERT (mantissa == x);
+  }
+
+  { /* Negative infinity.  */
+    int exp = -9999;
+    DOUBLE mantissa;
+    x = - INFINITY;
+    mantissa = FREXP (x, &exp);
+    ASSERT (mantissa == x);
+  }
+
+  { /* Positive zero.  */
+    int exp = -9999;
+    DOUBLE mantissa;
+    x = L_(0.0);
+    mantissa = FREXP (x, &exp);
+    ASSERT (exp == 0);
+    ASSERT (mantissa == x);
+    ASSERT (!signbit (mantissa));
+  }
+
+  { /* Negative zero.  */
+    int exp = -9999;
+    DOUBLE mantissa;
+    x = MINUS_ZERO;
+    mantissa = FREXP (x, &exp);
+    ASSERT (exp == 0);
+    ASSERT (mantissa == x);
+    ASSERT (signbit (mantissa));
+  }
+
+  for (i = 1, x = L_(1.0); i <= MAX_EXP; i++, x *= L_(2.0))
+    {
+      int exp = -9999;
+      DOUBLE mantissa = FREXP (x, &exp);
+      ASSERT (exp == i);
+      ASSERT (mantissa == L_(0.5));
+    }
+  for (i = 1, x = L_(1.0); i >= MIN_NORMAL_EXP; i--, x *= L_(0.5))
+    {
+      int exp = -9999;
+      DOUBLE mantissa = FREXP (x, &exp);
+      ASSERT (exp == i);
+      ASSERT (mantissa == L_(0.5));
+    }
+  for (; i >= MIN_EXP - 100 && x > L_(0.0); i--, x *= L_(0.5))
+    {
+      int exp = -9999;
+      DOUBLE mantissa = FREXP (x, &exp);
+      ASSERT (exp == i);
+      ASSERT (mantissa == L_(0.5));
+    }
+
+  for (i = 1, x = - L_(1.0); i <= MAX_EXP; i++, x *= L_(2.0))
+    {
+      int exp = -9999;
+      DOUBLE mantissa = FREXP (x, &exp);
+      ASSERT (exp == i);
+      ASSERT (mantissa == - L_(0.5));
+    }
+  for (i = 1, x = - L_(1.0); i >= MIN_NORMAL_EXP; i--, x *= L_(0.5))
+    {
+      int exp = -9999;
+      DOUBLE mantissa = FREXP (x, &exp);
+      ASSERT (exp == i);
+      ASSERT (mantissa == - L_(0.5));
+    }
+  for (; i >= MIN_EXP - 100 && x < L_(0.0); i--, x *= L_(0.5))
+    {
+      int exp = -9999;
+      DOUBLE mantissa = FREXP (x, &exp);
+      ASSERT (exp == i);
+      ASSERT (mantissa == - L_(0.5));
+    }
+
+  for (i = 1, x = L_(1.01); i <= MAX_EXP; i++, x *= L_(2.0))
+    {
+      int exp = -9999;
+      DOUBLE mantissa = FREXP (x, &exp);
+      ASSERT (exp == i);
+      ASSERT (mantissa == L_(0.505));
+    }
+  for (i = 1, x = L_(1.01); i >= MIN_NORMAL_EXP; i--, x *= L_(0.5))
+    {
+      int exp = -9999;
+      DOUBLE mantissa = FREXP (x, &exp);
+      ASSERT (exp == i);
+      ASSERT (mantissa == L_(0.505));
+    }
+  for (; i >= MIN_EXP - 100 && x > L_(0.0); i--, x *= L_(0.5))
+    {
+      int exp = -9999;
+      DOUBLE mantissa = FREXP (x, &exp);
+      ASSERT (exp == i);
+      ASSERT (mantissa >= L_(0.5));
+      ASSERT (mantissa < L_(1.0));
+      ASSERT (mantissa == my_ldexp (x, - exp));
+    }
+
+  for (i = 1, x = L_(1.73205); i <= MAX_EXP; i++, x *= L_(2.0))
+    {
+      int exp = -9999;
+      DOUBLE mantissa = FREXP (x, &exp);
+      ASSERT (exp == i);
+      ASSERT (mantissa == L_(0.866025));
+    }
+  for (i = 1, x = L_(1.73205); i >= MIN_NORMAL_EXP; i--, x *= L_(0.5))
+    {
+      int exp = -9999;
+      DOUBLE mantissa = FREXP (x, &exp);
+      ASSERT (exp == i);
+      ASSERT (mantissa == L_(0.866025));
+    }
+  for (; i >= MIN_EXP - 100 && x > L_(0.0); i--, x *= L_(0.5))
+    {
+      int exp = -9999;
+      DOUBLE mantissa = FREXP (x, &exp);
+      ASSERT (exp == i || exp == i + 1);
+      ASSERT (mantissa >= L_(0.5));
+      ASSERT (mantissa < L_(1.0));
+      ASSERT (mantissa == my_ldexp (x, - exp));
+    }
+}
--- a/tests/test-frexpf.c
+++ b/tests/test-frexpf.c
@@ -36,157 +36,26 @@
 #undef exp
 #define exp exponent
 
-static float
-my_ldexp (float x, int d)
-{
-  for (; d > 0; d--)
-    x *= 2.0f;
-  for (; d < 0; d++)
-    x *= 0.5f;
-  return x;
-}
+#undef INFINITY
+#undef NAN
+
+#define DOUBLE float
+#define VOLATILE volatile
+#define ISNAN isnanf
+#define INFINITY Infinityf ()
+#define NAN NaNf ()
+#define L_(literal) literal##f
+#define MINUS_ZERO minus_zerof
+#define MAX_EXP FLT_MAX_EXP
+#define MIN_EXP FLT_MIN_EXP
+#define MIN_NORMAL_EXP FLT_MIN_EXP
+#define FREXP frexpf
+#include "test-frexp.h"
 
 int
 main ()
 {
-  int i;
-  volatile float x;
-
-  { /* NaN.  */
-    int exp = -9999;
-    float mantissa;
-    x = NaNf ();
-    mantissa = frexpf (x, &exp);
-    ASSERT (isnanf (mantissa));
-  }
-
-  { /* Positive infinity.  */
-    int exp = -9999;
-    float mantissa;
-    x = Infinityf ();
-    mantissa = frexpf (x, &exp);
-    ASSERT (mantissa == x);
-  }
-
-  { /* Negative infinity.  */
-    int exp = -9999;
-    float mantissa;
-    x = - Infinityf ();
-    mantissa = frexpf (x, &exp);
-    ASSERT (mantissa == x);
-  }
-
-  { /* Positive zero.  */
-    int exp = -9999;
-    float mantissa;
-    x = 0.0f;
-    mantissa = frexpf (x, &exp);
-    ASSERT (exp == 0);
-    ASSERT (mantissa == x);
-    ASSERT (!signbit (mantissa));
-  }
-
-  { /* Negative zero.  */
-    int exp = -9999;
-    float mantissa;
-    x = minus_zerof;
-    mantissa = frexpf (x, &exp);
-    ASSERT (exp == 0);
-    ASSERT (mantissa == x);
-    ASSERT (signbit (mantissa));
-  }
-
-  for (i = 1, x = 1.0f; i <= FLT_MAX_EXP; i++, x *= 2.0f)
-    {
-      int exp = -9999;
-      float mantissa = frexpf (x, &exp);
-      ASSERT (exp == i);
-      ASSERT (mantissa == 0.5f);
-    }
-  for (i = 1, x = 1.0f; i >= FLT_MIN_EXP; i--, x *= 0.5f)
-    {
-      int exp = -9999;
-      float mantissa = frexpf (x, &exp);
-      ASSERT (exp == i);
-      ASSERT (mantissa == 0.5f);
-    }
-  for (; i >= FLT_MIN_EXP - 100 && x > 0.0f; i--, x *= 0.5f)
-    {
-      int exp = -9999;
-      float mantissa = frexpf (x, &exp);
-      ASSERT (exp == i);
-      ASSERT (mantissa == 0.5f);
-    }
-
-  for (i = 1, x = -1.0f; i <= FLT_MAX_EXP; i++, x *= 2.0f)
-    {
-      int exp = -9999;
-      float mantissa = frexpf (x, &exp);
-      ASSERT (exp == i);
-      ASSERT (mantissa == -0.5f);
-    }
-  for (i = 1, x = -1.0f; i >= FLT_MIN_EXP; i--, x *= 0.5f)
-    {
-      int exp = -9999;
-      float mantissa = frexpf (x, &exp);
-      ASSERT (exp == i);
-      ASSERT (mantissa == -0.5f);
-    }
-  for (; i >= FLT_MIN_EXP - 100 && x < 0.0f; i--, x *= 0.5f)
-    {
-      int exp = -9999;
-      float mantissa = frexpf (x, &exp);
-      ASSERT (exp == i);
-      ASSERT (mantissa == -0.5f);
-    }
-
-  for (i = 1, x = 1.01f; i <= FLT_MAX_EXP; i++, x *= 2.0f)
-    {
-      int exp = -9999;
-      float mantissa = frexpf (x, &exp);
-      ASSERT (exp == i);
-      ASSERT (mantissa == 0.505f);
-    }
-  for (i = 1, x = 1.01f; i >= FLT_MIN_EXP; i--, x *= 0.5f)
-    {
-      int exp = -9999;
-      float mantissa = frexpf (x, &exp);
-      ASSERT (exp == i);
-      ASSERT (mantissa == 0.505f);
-    }
-  for (; i >= FLT_MIN_EXP - 100 && x > 0.0f; i--, x *= 0.5f)
-    {
-      int exp = -9999;
-      float mantissa = frexpf (x, &exp);
-      ASSERT (exp == i);
-      ASSERT (mantissa >= 0.5f);
-      ASSERT (mantissa < 1.0f);
-      ASSERT (mantissa == my_ldexp (x, - exp));
-    }
-
-  for (i = 1, x = 1.73205f; i <= FLT_MAX_EXP; i++, x *= 2.0f)
-    {
-      int exp = -9999;
-      float mantissa = frexpf (x, &exp);
-      ASSERT (exp == i);
-      ASSERT (mantissa == 0.866025f);
-    }
-  for (i = 1, x = 1.73205f; i >= FLT_MIN_EXP; i--, x *= 0.5f)
-    {
-      int exp = -9999;
-      float mantissa = frexpf (x, &exp);
-      ASSERT (exp == i);
-      ASSERT (mantissa == 0.866025f);
-    }
-  for (; i >= FLT_MIN_EXP - 100 && x > 0.0f; i--, x *= 0.5f)
-    {
-      int exp = -9999;
-      float mantissa = frexpf (x, &exp);
-      ASSERT (exp == i || exp == i + 1);
-      ASSERT (mantissa >= 0.5f);
-      ASSERT (mantissa < 1.0f);
-      ASSERT (mantissa == my_ldexp (x, - exp));
-    }
+  test_function ();
 
   return 0;
 }
--- a/tests/test-frexpl.c
+++ b/tests/test-frexpl.c
@@ -37,6 +37,18 @@
 #undef exp
 #define exp exponent
 
+#undef INFINITY
+#undef NAN
+
+#define DOUBLE long double
+#define VOLATILE
+#define ISNAN isnanl
+#define INFINITY Infinityl ()
+#define NAN NaNl ()
+#define L_(literal) literal##L
+#define MINUS_ZERO minus_zerol
+#define MAX_EXP LDBL_MAX_EXP
+#define MIN_EXP LDBL_MIN_EXP
 /* On MIPS IRIX machines, LDBL_MIN_EXP is -1021, but the smallest reliable
    exponent for 'long double' is -964.  Similarly, on PowerPC machines,
    LDBL_MIN_EXP is -1021, but the smallest reliable exponent for 'long double'
@@ -49,161 +61,17 @@
 #else
 # define MIN_NORMAL_EXP LDBL_MIN_EXP
 #endif
-
-static long double
-my_ldexp (long double x, int d)
-{
-  for (; d > 0; d--)
-    x *= 2.0L;
-  for (; d < 0; d++)
-    x *= 0.5L;
-  return x;
-}
+#define FREXP frexpl
+#include "test-frexp.h"
 
 int
 main ()
 {
-  int i;
-  long double x;
   DECL_LONG_DOUBLE_ROUNDING
 
   BEGIN_LONG_DOUBLE_ROUNDING ();
 
-  { /* NaN.  */
-    int exp = -9999;
-    long double mantissa;
-    x = NaNl ();
-    mantissa = frexpl (x, &exp);
-    ASSERT (isnanl (mantissa));
-  }
-
-  { /* Positive infinity.  */
-    int exp = -9999;
-    long double mantissa;
-    x = Infinityl ();
-    mantissa = frexpl (x, &exp);
-    ASSERT (mantissa == x);
-  }
-
-  { /* Negative infinity.  */
-    int exp = -9999;
-    long double mantissa;
-    x = - Infinityl ();
-    mantissa = frexpl (x, &exp);
-    ASSERT (mantissa == x);
-  }
-
-  { /* Positive zero.  */
-    int exp = -9999;
-    long double mantissa;
-    x = 0.0L;
-    mantissa = frexpl (x, &exp);
-    ASSERT (exp == 0);
-    ASSERT (mantissa == x);
-    ASSERT (!signbit (mantissa));
-  }
-
-  { /* Negative zero.  */
-    int exp = -9999;
-    long double mantissa;
-    x = minus_zerol;
-    mantissa = frexpl (x, &exp);
-    ASSERT (exp == 0);
-    ASSERT (mantissa == x);
-    ASSERT (signbit (mantissa));
-  }
-
-  for (i = 1, x = 1.0L; i <= LDBL_MAX_EXP; i++, x *= 2.0L)
-    {
-      int exp = -9999;
-      long double mantissa = frexpl (x, &exp);
-      ASSERT (exp == i);
-      ASSERT (mantissa == 0.5L);
-    }
-  for (i = 1, x = 1.0L; i >= MIN_NORMAL_EXP; i--, x *= 0.5L)
-    {
-      int exp = -9999;
-      long double mantissa = frexpl (x, &exp);
-      ASSERT (exp == i);
-      ASSERT (mantissa == 0.5L);
-    }
-  for (; i >= LDBL_MIN_EXP - 100 && x > 0.0L; i--, x *= 0.5L)
-    {
-      int exp = -9999;
-      long double mantissa = frexpl (x, &exp);
-      ASSERT (exp == i);
-      ASSERT (mantissa == 0.5L);
-    }
-
-  for (i = 1, x = -1.0L; i <= LDBL_MAX_EXP; i++, x *= 2.0L)
-    {
-      int exp = -9999;
-      long double mantissa = frexpl (x, &exp);
-      ASSERT (exp == i);
-      ASSERT (mantissa == -0.5L);
-    }
-  for (i = 1, x = -1.0L; i >= MIN_NORMAL_EXP; i--, x *= 0.5L)
-    {
-      int exp = -9999;
-      long double mantissa = frexpl (x, &exp);
-      ASSERT (exp == i);
-      ASSERT (mantissa == -0.5L);
-    }
-  for (; i >= LDBL_MIN_EXP - 100 && x < 0.0L; i--, x *= 0.5L)
-    {
-      int exp = -9999;
-      long double mantissa = frexpl (x, &exp);
-      ASSERT (exp == i);
-      ASSERT (mantissa == -0.5L);
-    }
-
-  for (i = 1, x = 1.01L; i <= LDBL_MAX_EXP; i++, x *= 2.0L)
-    {
-      int exp = -9999;
-      long double mantissa = frexpl (x, &exp);
-      ASSERT (exp == i);
-      ASSERT (mantissa == 0.505L);
-    }
-  for (i = 1, x = 1.01L; i >= MIN_NORMAL_EXP; i--, x *= 0.5L)
-    {
-      int exp = -9999;
-      long double mantissa = frexpl (x, &exp);
-      ASSERT (exp == i);
-      ASSERT (mantissa == 0.505L);
-    }
-  for (; i >= LDBL_MIN_EXP - 100 && x > 0.0L; i--, x *= 0.5L)
-    {
-      int exp = -9999;
-      long double mantissa = frexpl (x, &exp);
-      ASSERT (exp == i);
-      ASSERT (mantissa >= 0.5L);
-      ASSERT (mantissa < 1.0L);
-      ASSERT (mantissa == my_ldexp (x, - exp));
-    }
-
-  for (i = 1, x = 1.73205L; i <= LDBL_MAX_EXP; i++, x *= 2.0L)
-    {
-      int exp = -9999;
-      long double mantissa = frexpl (x, &exp);
-      ASSERT (exp == i);
-      ASSERT (mantissa == 0.866025L);
-    }
-  for (i = 1, x = 1.73205L; i >= MIN_NORMAL_EXP; i--, x *= 0.5L)
-    {
-      int exp = -9999;
-      long double mantissa = frexpl (x, &exp);
-      ASSERT (exp == i);
-      ASSERT (mantissa == 0.866025L);
-    }
-  for (; i >= LDBL_MIN_EXP - 100 && x > 0.0L; i--, x *= 0.5L)
-    {
-      int exp = -9999;
-      long double mantissa = frexpl (x, &exp);
-      ASSERT (exp == i || exp == i + 1);
-      ASSERT (mantissa >= 0.5L);
-      ASSERT (mantissa < 1.0L);
-      ASSERT (mantissa == my_ldexp (x, - exp));
-    }
+  test_function ();
 
   return 0;
 }