2 Copyright 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/>. */
22 #include "signature.h"
23 SIGNATURE_CHECK (setpayloadf
, int, (float *, float));
26 #include "isnanf-nolibm.h"
29 #define PAYLOAD_BITS (24 - 2) /* = (FLT_MANT_DIG - 2) */
38 /* Test valid payloads. */
39 for (i
= 0, p
= 1.0f
; i
< PAYLOAD_BITS
; i
++, p
*= 2.0f
)
44 ret
= setpayloadf (&x
, p
);
48 /* Test out-of-range payload. */
52 ret
= setpayloadf (&x
, p
);
57 /* Test infinite payload. */
62 ret
= setpayloadf (&x
, Infinityf ());
67 /* Test negative payload. */
72 ret
= setpayloadf (&x
, -1.0f
);
77 /* Test fractional payload. */
82 ret
= setpayloadf (&x
, 1.4f
);
87 return test_exit_status
;