]>
git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/ieee754/ldbl-128ibm/test-fmodrem-ldbl-128ibm.c
1 /* Test for ldbl-128ibm fmodl etc. handling of equal values.
2 Copyright (C) 2016-2023 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 <https://www.gnu.org/licenses/>. */
24 /* FUNC is defined to be the name of the function to test. */
26 #define STR(x) STRX (x)
27 #define SFUNC STR (FUNC)
35 volatile union u p1
= { .d
= { DBL_MIN
, 0.0 } };
36 volatile union u p2
= { .d
= { DBL_MIN
, -0.0 } };
37 volatile union u m1
= { .d
= { -DBL_MIN
, 0.0 } };
38 volatile union u m2
= { .d
= { -DBL_MIN
, -0.0 } };
41 test_func (const char *s
, long double x
, long double y
, long double expected
)
43 volatile long double r
;
45 if (r
!= expected
|| copysignl (1.0, r
) != copysignl (1.0, expected
))
47 printf ("FAIL: " SFUNC
" (%s)\n", s
);
52 printf ("PASS: " SFUNC
" (%s)\n", s
);
57 #define TEST_FUNC(a, b, e) test_func (#a ", " #b, a, b, e)
64 result
|= TEST_FUNC (p1
.ld
, p1
.ld
, 0.0L);
65 result
|= TEST_FUNC (p1
.ld
, p2
.ld
, 0.0L);
66 result
|= TEST_FUNC (p1
.ld
, m1
.ld
, 0.0L);
67 result
|= TEST_FUNC (p1
.ld
, m2
.ld
, 0.0L);
68 result
|= TEST_FUNC (p2
.ld
, p1
.ld
, 0.0L);
69 result
|= TEST_FUNC (p2
.ld
, p2
.ld
, 0.0L);
70 result
|= TEST_FUNC (p2
.ld
, m1
.ld
, 0.0L);
71 result
|= TEST_FUNC (p2
.ld
, m2
.ld
, 0.0L);
72 result
|= TEST_FUNC (m1
.ld
, p1
.ld
, -0.0L);
73 result
|= TEST_FUNC (m1
.ld
, p2
.ld
, -0.0L);
74 result
|= TEST_FUNC (m1
.ld
, m1
.ld
, -0.0L);
75 result
|= TEST_FUNC (m1
.ld
, m2
.ld
, -0.0L);
76 result
|= TEST_FUNC (m2
.ld
, p1
.ld
, -0.0L);
77 result
|= TEST_FUNC (m2
.ld
, p2
.ld
, -0.0L);
78 result
|= TEST_FUNC (m2
.ld
, m1
.ld
, -0.0L);
79 result
|= TEST_FUNC (m2
.ld
, m2
.ld
, -0.0L);
83 #define TEST_FUNCTION do_test ()
84 #include "../../../test-skeleton.c"