From 19ab6c7a389e7da948b7bab21c12c238fa3e59a1 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 3 Mar 2012 13:35:37 +0100 Subject: [PATCH] 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. --- ChangeLog | 11 ++++ modules/frexp-tests | 1 + modules/frexpf-tests | 1 + modules/frexpl-tests | 1 + tests/test-frexp.c | 173 +++++++-------------------------------------------- tests/test-frexp.h | 168 +++++++++++++++++++++++++++++++++++++++++++++++++ tests/test-frexpf.c | 163 +++++------------------------------------------- tests/test-frexpl.c | 162 +++++------------------------------------------ 8 files changed, 234 insertions(+), 446 deletions(-) create mode 100644 tests/test-frexp.h diff --git a/ChangeLog b/ChangeLog index ab73cce86..127cb2f20 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2012-03-03 Bruno Haible + + 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 maint: don't specify XZ_OPT=-9ev in dist-related rule diff --git a/modules/frexp-tests b/modules/frexp-tests index 55ddaa4db..3b3b837c6 100644 --- 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 diff --git a/modules/frexpf-tests b/modules/frexpf-tests index 34252a80f..2efb31a8f 100644 --- 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 diff --git a/modules/frexpl-tests b/modules/frexpl-tests index 098795508..ee9f4c5fb 100644 --- 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 diff --git a/tests/test-frexp.c b/tests/test-frexp.c index 7158c8f10..0065af358 100644 --- a/tests/test-frexp.c +++ b/tests/test-frexp.c @@ -36,162 +36,31 @@ SIGNATURE_CHECK (frexp, double, (double, int *)); #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; } diff --git a/tests/test-frexp.h b/tests/test-frexp.h new file mode 100644 index 000000000..3ea52b974 --- /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 . */ + +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)); + } +} diff --git a/tests/test-frexpf.c b/tests/test-frexpf.c index 78f6ee2a5..fa469284b 100644 --- a/tests/test-frexpf.c +++ b/tests/test-frexpf.c @@ -36,157 +36,26 @@ SIGNATURE_CHECK (frexpf, float, (float, int *)); #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; } diff --git a/tests/test-frexpl.c b/tests/test-frexpl.c index ca28f8a1c..b46cb2ae1 100644 --- a/tests/test-frexpl.c +++ b/tests/test-frexpl.c @@ -37,6 +37,18 @@ SIGNATURE_CHECK (frexpl, long double, (long double, int *)); #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 @@ SIGNATURE_CHECK (frexpl, long double, (long double, int *)); #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; } -- 2.11.0