diff options
author | Jörg Frings-Fürst <debian@jff.email> | 2024-03-03 19:11:32 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff.email> | 2024-03-03 19:11:32 +0100 |
commit | 00893e79fc62966067af1a106567db96bd170338 (patch) | |
tree | 52b35cd0b42ca28e62a2ffbecade2e13dd8332cf /tests/test-float.c | |
parent | 26112352a774737e1ce5580c93654a26c1e82b39 (diff) |
New upstream version 1.2upstream/1.2
Diffstat (limited to 'tests/test-float.c')
-rw-r--r-- | tests/test-float.c | 72 |
1 files changed, 40 insertions, 32 deletions
diff --git a/tests/test-float.c b/tests/test-float.c index 986f7da8..e9dc4609 100644 --- a/tests/test-float.c +++ b/tests/test-float.c @@ -1,5 +1,5 @@ /* Test of <float.h> substitute. - Copyright (C) 2011-2022 Free Software Foundation, Inc. + Copyright (C) 2011-2024 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 @@ -20,12 +20,48 @@ #include <float.h> -#include "fpucw.h" -#include "macros.h" - /* Check that FLT_RADIX is a constant expression. */ int a[] = { FLT_RADIX }; +/* ----------------------- Check macros for 'float' ----------------------- */ + +/* Check that the FLT_* macros expand to constant expressions. */ +int fb[] = + { + FLT_MANT_DIG, FLT_MIN_EXP, FLT_MAX_EXP, + FLT_DIG, FLT_MIN_10_EXP, FLT_MAX_10_EXP + }; +float fc[] = { FLT_EPSILON, FLT_MIN, FLT_MAX }; + +/* ----------------------- Check macros for 'double' ----------------------- */ + +/* Check that the DBL_* macros expand to constant expressions. */ +int db[] = + { + DBL_MANT_DIG, DBL_MIN_EXP, DBL_MAX_EXP, + DBL_DIG, DBL_MIN_10_EXP, DBL_MAX_10_EXP + }; +double dc[] = { DBL_EPSILON, DBL_MIN, DBL_MAX }; + +/* -------------------- Check macros for 'long double' -------------------- */ + +/* Check that the LDBL_* macros expand to constant expressions. */ +int lb[] = + { + LDBL_MANT_DIG, LDBL_MIN_EXP, LDBL_MAX_EXP, + LDBL_DIG, LDBL_MIN_10_EXP, LDBL_MAX_10_EXP + }; +long double lc1 = LDBL_EPSILON; +long double lc2 = LDBL_MIN; +#if 0 /* LDBL_MAX is not a constant expression on some platforms. */ +long double lc3 = LDBL_MAX; +#endif + +/* ------------------------------------------------------------------------- */ + +#include "fpucw.h" +#include "macros.h" + #if FLT_RADIX == 2 /* Return 2^n. */ @@ -117,14 +153,6 @@ pow2l (int n) /* ----------------------- Check macros for 'float' ----------------------- */ -/* Check that the FLT_* macros expand to constant expressions. */ -int fb[] = - { - FLT_MANT_DIG, FLT_MIN_EXP, FLT_MAX_EXP, - FLT_DIG, FLT_MIN_10_EXP, FLT_MAX_10_EXP - }; -float fc[] = { FLT_EPSILON, FLT_MIN, FLT_MAX }; - static void test_float (void) { @@ -196,14 +224,6 @@ test_float (void) /* ----------------------- Check macros for 'double' ----------------------- */ -/* Check that the DBL_* macros expand to constant expressions. */ -int db[] = - { - DBL_MANT_DIG, DBL_MIN_EXP, DBL_MAX_EXP, - DBL_DIG, DBL_MIN_10_EXP, DBL_MAX_10_EXP - }; -double dc[] = { DBL_EPSILON, DBL_MIN, DBL_MAX }; - static void test_double (void) { @@ -275,18 +295,6 @@ test_double (void) /* -------------------- Check macros for 'long double' -------------------- */ -/* Check that the LDBL_* macros expand to constant expressions. */ -int lb[] = - { - LDBL_MANT_DIG, LDBL_MIN_EXP, LDBL_MAX_EXP, - LDBL_DIG, LDBL_MIN_10_EXP, LDBL_MAX_10_EXP - }; -long double lc1 = LDBL_EPSILON; -long double lc2 = LDBL_MIN; -#if 0 /* LDBL_MAX is not a constant expression on some platforms. */ -long double lc3 = LDBL_MAX; -#endif - static void test_long_double (void) { |