2 !!DESCRIPTION!! C-Manual Chapter 2.44: floating point constants
3 !!ORIGIN!! LCC 4.1 Testsuite
4 !!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
10 int cbits; /* No. of bits per char */
12 int sbits; /* short */
14 int ubits; /* unsigned */
15 int fbits; /* float */
16 int dbits; /* double */
18 float fprec; /* Smallest number that can be */
19 float dprec; /* significantly added to 1. */
21 int flgs; /* Print return codes, by section */
22 int flgm; /* Announce machine dependencies */
23 int flgd; /* give explicit diagnostics */
24 int flgl; /* Report local return codes. */
25 int rrc; /* recent return code */
26 int crc; /* Cumulative return code */
27 char rfs[8]; /* Return from section */
31 int ubits; /* unsigned */
32 int fbits; /* float */
33 int dbits; /* double */
35 float fprec; /* Smallest number that can be */
36 float dprec; /* significantly added to 1. */
38 int flgs; /* Print return codes, by section */
39 int flgm; /* Announce machine dependencies */
40 int flgd; /* give explicit diagnostics */
41 int flgl; /* Report local return codes. */
42 int rrc; /* recent return code */
43 int crc; /* Cumulative return code */
44 char rfs[8]; /* Return from section */
46 #ifndef NO_OLD_FUNC_DECL
51 s244(struct defs *pd0) {
58 static char s244er[] = "s244,er%d\n";
59 static char qs244[8] = "s244 ";
68 /* Unfortunately, there's not a lot we can do with floating constants.
69 We can check to see that the various representations can be com-
70 piled, that the conversion is such that they yield the same hard-
71 ware representations in all cases, and that all representations
72 thus checked are double precision. */
84 for (j=0; j<7; j++) if(a[j] != a[j+1]) lrc = 1;
87 if(pd0->flgd != 0) printf(s244er,1);
91 if ( (sizeof .1250E+04 ) != sizeof(double)
92 || (sizeof 1.250E3 ) != sizeof(double)
93 || (sizeof 12.50E02 ) != sizeof(double)
94 || (sizeof 1.250e+1 ) != sizeof(double)
95 || (sizeof 1250e00 ) != sizeof(double)
96 || (sizeof 12500.e-01) != sizeof(double)
97 || (sizeof 125000e-2 ) != sizeof(double)
98 || (sizeof 1250. ) != sizeof(double)){
99 if(pd0->flgd != 0) printf(s244er,2);
112 /*********************************************************************************************
113 the main loop that launches the sections
114 *********************************************************************************************/
116 #define cq_sections 1
118 #ifndef NO_TYPELESS_STRUCT_PTR
119 int section(int j,struct* pd0){
121 int section(int j,void* pd0){
124 case 0: return s244(pd0);
129 C REFERENCE MANUAL (main)
132 #ifndef NO_OLD_FUNC_DECL
138 int main(int n,char **args) {
142 static struct defs d0, *pd0;
144 d0.flgs = 1; /* These flags dictate */
145 d0.flgm = 1; /* the verbosity of */
146 d0.flgd = 1; /* the program. */
151 for (j=0; j<cq_sections; j++) {
152 d0.rrc=section(j,pd0);
153 d0.crc=d0.crc+d0.rrc;
154 if(d0.flgs != 0) printf("Section %s returned %d.\n",d0.rfs,d0.rrc);
157 if(d0.crc == 0) printf("\nNo errors detected.\n");
158 else printf("\nFailed.\n");