2 * this file contains misc bug reports from WinBond.
8 #define pass(x) printf("PASS: %s\n", x);
9 #define fail(x) printf("FAIL: %s\n", x);
13 The compare operation is error. Because the constant value 1.0 is
14 not correct. It seems compare with 0 in this statement.
19 *cp = be9a1cac, *cp1 = be9a1cac
20 PASS: float multiple 1
21 PASS: float multiple 2
26 These test only pass if the output matches:
28 1.0 = 1.000000E+00, 0.3010 = 3.000000E-01, -1.0 = -1.000000E+0
29 1.0 = 1.000000E+00, 0.3010 = 3.010000E-01, -1.0 = -1.000000E+00
30 These test only pass if the outut matches:
32 ans = 1.000000E+00, ans1 = 3.010000E-01, ans2 = -1.000000E+00
33 ans = 1.000000E+00, ans1 = 3.010000E-01, ans2 = -1.000000E+00
40 *cp = be9a1cac, *cp1 = be9a1cac
41 PASS: float multiple 1
42 PASS: float multiple 2
43 32760 / (-2) = -2147467268
47 These test only pass if the output matches:
49 1.0 = 1.000000E+00, 0.3010 = 3.000000E-01, -1.0 = -1.000000E+0
50 1.0 = 1.586860E-318, 0.3010 = -1.009091E-303, -1.0 = 5.290504E-315
51 These test only pass if the outut matches:
53 ans = 1.000000E+00, ans1 = 3.010000E-01, ans2 = -1.000000E+00
54 ans = 4.940656E-324, ans1 = -5.299809E-315, ans2 = 5.290504E-315
62 printf ("dist is %G\n", dist
);
64 pass ("float compare");
66 fail ("float compare");
78 * *cp = be9a1cac, *cp1 = 00000000
83 unsigned int *cp
=&ans
, *cp1
=&ans1
;
86 ans
= (-1.0) * 0.3010 * 1.0; /* OK */
87 ans1
= (-1.0) * i
* 1.0; /* Disaster */
88 printf ("*cp = %08x, *cp1 = %08x\n", *cp
, *cp1
);
90 if (*cp
!= 0xbe9a1cac) {
91 fail ("float multiple 1");
93 pass ("float multiple 1");
96 if (*cp1
!= 0xbe9a1cac) {
97 fail ("float multiple 2");
99 pass ("float multiple 2");
104 Positive integer divide Negative integer may get interesting result.
106 EX1: 32760 / (-2) = -2147467268
115 printf ("%d / (%d) = %d\n", i
, j
, value
);
117 if (value
!= -16380) {
118 fail ("float divide 1");
120 pass ("float divide 1");
125 EX2: 32760 / (-1) = 32760
134 printf ("%d / (%d) = %d\n", i
, j
, value
);
136 if (value
!= -32760) {
137 fail ("float divide 1");
139 pass ("float divide 1");
144 The data output format %e, %E, %g, %G in printf() can not work.
145 Please test the following example:
147 1.0 = 1.000000E+00, 0.3010 = 3.009999E-01, -1.0 = -1.000000E+00
148 ans = 4.940656E-324, ans1 = -5.299809E-315, ans2 = 5.290504E-315
152 float ans
, ans1
, ans2
;
158 printf ("These test only pass if the output matches:\nCorrect output is\n1.0 = 1.000000E+00, 0.3010 = 3.000000E-01, -1.0 = -1.000000E+0\n");
159 printf ("1.0 = %E, 0.3010 = %E, -1.0 = %E\n", 1.0, 0.3010, -1.0);
160 printf ("These test only pass if the outut matches:\nCorrect output is\nans = 1.000000E+00, ans1 = 3.010000E-01, ans2 = -1.000000E+00\n");
161 printf ("ans = %E, ans1 = %E, ans2 = %E\n", ans
, ans1
, ans2
);