Add sysdeps/ieee754/soft-fp.
[glibc.git] / math / test-iseqsig-excess-precision.c
blobe36160c926627f6f004219a6f52bfa13ef90cdc8
1 /* Test iseqsig with excess precision.
2 Copyright (C) 2016-2017 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
19 #include <float.h>
20 #include <math.h>
21 #include <stdio.h>
23 static int
24 do_test (void)
26 int result = 0;
28 if (FLT_EVAL_METHOD == 1 || FLT_EVAL_METHOD == 2 || FLT_EVAL_METHOD > 32)
30 /* Excess precision for float. */
31 if (iseqsig (1.0f, 1.0f + (float) DBL_EPSILON))
33 puts ("iseqsig removes excess precision float -> double");
34 result = 1;
36 else
37 puts ("iseqsig preserves excess precision float -> double");
38 if (iseqsig (__builtin_inff (), FLT_MAX * FLT_MAX))
40 puts ("iseqsig removes excess range float -> double");
41 result = 1;
43 else
44 puts ("iseqsig preserves excess range float -> double");
47 if (FLT_EVAL_METHOD == 2 || FLT_EVAL_METHOD > 64)
49 /* Excess precision for float and double. */
50 if (iseqsig (1.0f, 1.0f + (float) LDBL_EPSILON))
52 puts ("iseqsig removes excess precision float -> long double");
53 result = 1;
55 else
56 puts ("iseqsig preserves excess precision float -> long double");
57 if (iseqsig (1.0, 1.0 + (double) LDBL_EPSILON))
59 puts ("iseqsig removes excess precision double -> long double");
60 result = 1;
62 else
63 puts ("iseqsig preserves excess precision double -> long double");
64 if (LDBL_MAX_EXP >= 2 * DBL_MAX_EXP)
66 if (iseqsig (__builtin_inf (), DBL_MAX * DBL_MAX))
68 puts ("iseqsig removes excess range double -> long double");
69 result = 1;
71 else
72 puts ("iseqsig preserves excess range double -> long double");
76 return result;
79 #define TEST_FUNCTION do_test ()
80 #include "../test-skeleton.c"