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
8 int cbits; /* No. of bits per char */
10 int sbits; /* short */
12 int ubits; /* unsigned */
13 int fbits; /* float */
14 int dbits; /* double */
16 float fprec; /* Smallest number that can be */
17 float dprec; /* significantly added to 1. */
19 int flgs; /* Print return codes, by section */
20 int flgm; /* Announce machine dependencies */
21 int flgd; /* give explicit diagnostics */
22 int flgl; /* Report local return codes. */
23 int rrc; /* recent return code */
24 int crc; /* Cumulative return code */
25 char rfs[8]; /* Return from section */
29 int ubits; /* unsigned */
30 int fbits; /* float */
31 int dbits; /* double */
33 float fprec; /* Smallest number that can be */
34 float dprec; /* significantly added to 1. */
36 int flgs; /* Print return codes, by section */
37 int flgm; /* Announce machine dependencies */
38 int flgd; /* give explicit diagnostics */
39 int flgl; /* Report local return codes. */
40 int rrc; /* recent return code */
41 int crc; /* Cumulative return code */
42 char rfs[8]; /* Return from section */
44 #ifndef NO_OLD_FUNC_DECL
49 s244(struct defs *pd0) {
56 static char s244er[] = "s244,er%d\n";
57 static char qs244[8] = "s244 ";
66 /* Unfortunately, there's not a lot we can do with floating constants.
67 We can check to see that the various representations can be com-
68 piled, that the conversion is such that they yield the same hard-
69 ware representations in all cases, and that all representations
70 thus checked are double precision. */
82 for (j=0; j<7; j++) if(a[j] != a[j+1]) lrc = 1;
85 if(pd0->flgd != 0) printf(s244er,1);
89 if ( (sizeof .1250E+04 ) != sizeof(double)
90 || (sizeof 1.250E3 ) != sizeof(double)
91 || (sizeof 12.50E02 ) != sizeof(double)
92 || (sizeof 1.250e+1 ) != sizeof(double)
93 || (sizeof 1250e00 ) != sizeof(double)
94 || (sizeof 12500.e-01) != sizeof(double)
95 || (sizeof 125000e-2 ) != sizeof(double)
96 || (sizeof 1250. ) != sizeof(double)){
97 if(pd0->flgd != 0) printf(s244er,2);
110 /*********************************************************************************************
111 the main loop that launches the sections
112 *********************************************************************************************/
114 #define cq_sections 1
116 #ifndef NO_TYPELESS_STRUCT_PTR
117 int section(int j,struct* pd0){
119 int section(int j,void* pd0){
122 case 0: return s244(pd0);
127 C REFERENCE MANUAL (main)
130 #ifndef NO_OLD_FUNC_DECL
136 int main(int n,char **args) {
140 static struct defs d0, *pd0;
142 d0.flgs = 1; /* These flags dictate */
143 d0.flgm = 1; /* the verbosity of */
144 d0.flgd = 1; /* the program. */
149 for (j=0; j<cq_sections; j++) {
150 d0.rrc=section(j,pd0);
151 d0.crc=d0.crc+d0.rrc;
152 if(d0.flgs != 0) printf("Section %s returned %d.\n",d0.rfs,d0.rrc);
155 if(d0.crc == 0) printf("\nNo errors detected.\n");
156 else printf("\nFailed.\n");