]>
git.proxmox.com Git - rustc.git/blob - src/compiler-rt/test/builtins/Unit/truncdfhf2_test.c
1 //===--------------- truncdfhf2_test.c - Test __truncdfhf2 ----------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file tests __truncdfhf2 for the compiler_rt library.
12 //===----------------------------------------------------------------------===//
18 uint16_t __truncdfhf2(double a
);
20 int test__truncdfhf2(double a
, uint16_t expected
)
22 uint16_t x
= __truncdfhf2(a
);
23 int ret
= compareResultH(x
, expected
);
26 printf("error in test__truncdfhf2(%f) = %#.4x, "
27 "expected %#.4x\n", a
, x
, fromRep16(expected
));
32 char assumption_1
[sizeof(__fp16
) * CHAR_BIT
== 16] = {0};
37 if (test__truncdfhf2(makeQNaN64(),
41 if (test__truncdfhf2(makeNaN64(UINT64_C(0x8000)),
45 if (test__truncdfhf2(makeInf64(),
48 if (test__truncdfhf2(-makeInf64(),
52 if (test__truncdfhf2(0.0, UINT16_C(0x0)))
54 if (test__truncdfhf2(-0.0, UINT16_C(0x8000)))
57 if (test__truncdfhf2(3.1415926535,
60 if (test__truncdfhf2(-3.1415926535,
63 if (test__truncdfhf2(0x1.987124876876324p
+1000,
66 if (test__truncdfhf2(0x1.987124876876324p
+12,
69 if (test__truncdfhf2(0x1.0p
+0,
72 if (test__truncdfhf2(0x1.0p
-14,
76 if (test__truncdfhf2(0x1.0p
-20,
79 if (test__truncdfhf2(0x1.0p
-24,
82 if (test__truncdfhf2(-0x1.0p
-24,
85 if (test__truncdfhf2(0x1.5p
-25,
89 if (test__truncdfhf2(0x1.0p
-25,
92 if (test__truncdfhf2(-0x1.0p
-25,
96 if (test__truncdfhf2(65504.0,
100 if (test__truncdfhf2(65519.0,
104 if (test__truncdfhf2(65520.0,
107 if (test__truncdfhf2(-65520.0,
110 if (test__truncdfhf2(65536.0,