1 /* Test of remainder*() function family.
2 Copyright (C) 2012-2024 Free Software Foundation, Inc.
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
20 /* [MX] shaded specification in POSIX. */
23 ASSERT (ISNAN (REMAINDER (NAN
, L_(2.0))));
24 ASSERT (ISNAN (REMAINDER (NAN
, L_(0.0))));
25 ASSERT (ISNAN (REMAINDER (L_(2.0), NAN
)));
26 ASSERT (ISNAN (REMAINDER (L_(0.0), NAN
)));
27 ASSERT (ISNAN (REMAINDER (NAN
, NAN
)));
30 ASSERT (ISNAN (REMAINDER (L_(2.0), L_(0.0))));
31 ASSERT (ISNAN (REMAINDER (L_(2.0), MINUS_ZERO
)));
32 ASSERT (ISNAN (REMAINDER (INFINITY
, L_(0.0))));
33 ASSERT (ISNAN (REMAINDER (INFINITY
, MINUS_ZERO
)));
36 ASSERT (ISNAN (REMAINDER (INFINITY
, L_(2.0))));
37 ASSERT (ISNAN (REMAINDER (INFINITY
, - L_(2.0))));
39 /* The following tests originally applied to the FMOD function.
40 They are not specified for the REMAINDER function by POSIX. */
44 DOUBLE z
= REMAINDER (L_(0.0), L_(2.0));
45 ASSERT (z
== L_(0.0));
46 ASSERT (!signbit (z
));
49 DOUBLE z
= REMAINDER (MINUS_ZERO
, L_(2.0));
50 ASSERT (z
== L_(0.0));
51 ASSERT (!!signbit (z
) == !!signbit (MINUS_ZERO
));
54 DOUBLE z
= REMAINDER (L_(0.0), - L_(2.0));
55 ASSERT (z
== L_(0.0));
56 ASSERT (!signbit (z
));
59 DOUBLE z
= REMAINDER (MINUS_ZERO
, - L_(2.0));
60 ASSERT (z
== L_(0.0));
61 ASSERT (!!signbit (z
) == !!signbit (MINUS_ZERO
));