]> git.ipfire.org Git - thirdparty/glibc.git/blob - math/test-signgam-main.c
Fix http: URL in 'configure'
[thirdparty/glibc.git] / math / test-signgam-main.c
1 /* Test lgamma functions do not set signgam for ISO C.
2 Copyright (C) 2015-2019 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
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.
9
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.
14
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 <https://www.gnu.org/licenses/>. */
18
19 #undef _LIBC
20 #undef __LIBC_INTERNAL_MATH_INLINES
21 #undef _GNU_SOURCE
22
23 #include <math.h>
24 #include <stdio.h>
25
26 #define INITVAL ((TYPE) -1 / 3)
27
28 #if DO_INIT
29 TYPE signgam = INITVAL;
30 #else
31 TYPE signgam;
32 #endif
33
34 #define RUN_TESTS(FUNC, TYPE) \
35 do \
36 { \
37 volatile TYPE a, b, c __attribute__ ((unused)); \
38 a = 0.5; \
39 b = -0.5; \
40 signgam = INITVAL; \
41 c = FUNC (a); \
42 if (signgam == INITVAL) \
43 puts ("PASS: " #FUNC " (0.5) setting signgam"); \
44 else \
45 { \
46 puts ("FAIL: " #FUNC " (0.5) setting signgam"); \
47 result = 1; \
48 } \
49 signgam = INITVAL; \
50 c = FUNC (b); \
51 if (signgam == INITVAL) \
52 puts ("PASS: " #FUNC " (-0.5) setting signgam"); \
53 else \
54 { \
55 puts ("FAIL: " #FUNC " (-0.5) setting signgam"); \
56 result = 1; \
57 } \
58 } \
59 while (0)
60
61 int
62 main (void)
63 {
64 int result = 0;
65 RUN_TESTS (lgammaf, float);
66 RUN_TESTS (lgamma, double);
67 RUN_TESTS (lgammal, long double);
68 return result;
69 }