tccgen.c: Fix memory leak involving asm_label.
[tinycc.git] / tests / tests2 / 70_floating_point_literals.c
blob012fb4fab5dc52e528bc31e340a1e8653ed3e63b
1 #include <stdio.h>
3 int main()
5 /* decimal floating constant */
6 float fa0 = .123f;
7 float fa1 = .123E12F;
8 float fa2 = .123e-12f;
9 float fa3 = .123e+12f;
10 printf("%f\n%f\n%f\n%f\n\n", fa0, fa1, fa2, fa3);
12 float fb0 = 123.123f;
13 float fb1 = 123.123E12F;
14 float fb2 = 123.123e-12f;
15 float fb3 = 123.123e+12f;
16 printf("%f\n%f\n%f\n%f\n\n", fb0, fb1, fb2, fb3);
18 float fc0 = 123.f;
19 float fc1 = 123.E12F;
20 float fc2 = 123.e-12f;
21 float fc3 = 123.e+12f;
22 printf("%f\n%f\n%f\n%f\n\n", fc0, fc1, fc2, fc3);
24 float fd0 = 123E12F;
25 float fd1 = 123e-12f;
26 float fd2 = 123e+12f;
27 printf("%f\n%f\n%f\n\n", fd0, fd1, fd2);
28 printf("\n");
30 /* hexadecimal floating constant */
31 double da0 = 0X.1ACP12;
32 double da1 = 0x.1acp-12;
33 double da2 = 0x.1acp+12;
34 printf("%f\n%f\n%f\n\n", da0, da1, da2);
36 double db0 = 0X1AC.BDP12;
37 double db1 = 0x1ac.bdp-12;
38 double db2 = 0x1ac.dbp+12;
39 printf("%f\n%f\n%f\n\n", db0, db1, db2);
41 double dc0 = 0X1AC.P12;
42 double dc1 = 0x1ac.p-12;
43 double dc2 = 0x1ac.p+12;
44 printf("%f\n%f\n%f\n\n", dc0, dc1, dc2);
46 double dd0 = 0X1ACP12;
47 double dd1 = 0x1acp-12;
48 double dd2 = 0x1acp+12;
49 printf("%f\n%f\n%f\n\n", dd0, dd1, dd2);
50 printf("\n");
52 #ifdef __TINYC__
53 /* TCC extension
54 binary floating constant */
55 long double la0 = 0B.110101100P12L;
56 long double la1 = 0b.110101100p-12l;
57 long double la2 = 0b.110101100p+12l;
58 printf("%Lf\n%Lf\n%Lf\n\n", la0, la1, la2);
60 long double lb0 = 0B110101100.10111101P12L;
61 long double lb1 = 0b110101100.10111101p-12l;
62 long double lb2 = 0b110101100.10111101p+12l;
63 printf("%Lf\n%Lf\n%Lf\n\n", lb0, lb1, lb2);
65 long double lc0 = 0B110101100.P12L;
66 long double lc1 = 0b110101100.p-12l;
67 long double lc2 = 0b110101100.p+12l;
68 printf("%Lf\n%Lf\n%Lf\n\n", lc0, lc1, lc2);
70 long double ld0 = 0B110101100P12L;
71 long double ld1 = 0b110101100p-12l;
72 long double ld2 = 0b110101100p+12l;
73 printf("%Lf\n%Lf\n%Lf\n\n", ld0, ld1, ld2);
74 #endif
76 return 0;