struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / bug-3276.c
blobda7e8493dee5b0cc753a59e1b16a82ec8df9f3e3
1 /* bug-3276.c
2 * A billion became zero when converted to and from float. Also test related range issues.
3 */
5 #include <testfwk.h>
7 volatile unsigned long ul1;
8 volatile unsigned long ul2;
9 volatile float f1;
11 void
12 testBug(void)
14 #if !defined(__SDCC_pdk14)
15 ul1 = 1000000000ul;
16 f1 = (float)ul1;
17 ASSERT (f1 == 1000000000.0f);
18 ul2 = (unsigned long)f1;
19 ASSERT (ul2 == ul1);
20 ul1 = 4000000000ul;
21 f1 = (float)ul1;
22 ASSERT (f1 == 4000000000.0f);
23 ul2 = (unsigned long)f1;
24 ASSERT (ul2 == ul1);
25 ul1 = 0xfffffffful;
26 f1 = (float)ul1;
27 ASSERT (f1 == 4294967296.0f);
28 #endif