struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / bug-3352.c
blobb5e84bd076ef2a131152b3827fe99ea91796ddb0
1 /* bug-3352.c
2 A check for a division by 0 assumed the divisor to have integer type, resulting in a wrong value for compile-time divisions by float values close to 0. There was also a divide-by-zero wanring emitted.
3 */
5 #include <testfwk.h>
7 #pragma disable_warning 85
9 float m(int argc, char **argv)
11 int mx = 384, x0 = 1, x1 = (mx - 1) - 1;
12 int my = 192, y0 = 1, y1 = (my - 1) - 8;
13 float w1 = -0.866, w3 = -0.791, w2 = -0.24;
14 float ar = (float)(my*4)/(float)(mx*3);
15 float w4 = (w3 - w1)*(float)(y1 - y0)/(float)(x1 - x0)/ar + w2;
18 return w4;
21 void
22 testBug (void)
24 ASSERT (m(0, 0) < 0);