blob: b5e84bd076ef2a131152b3827fe99ea91796ddb0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
/* bug-3352.c
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.
*/
#include <testfwk.h>
#pragma disable_warning 85
float m(int argc, char **argv)
{
int mx = 384, x0 = 1, x1 = (mx - 1) - 1;
int my = 192, y0 = 1, y1 = (my - 1) - 8;
float w1 = -0.866, w3 = -0.791, w2 = -0.24;
float ar = (float)(my*4)/(float)(mx*3);
float w4 = (w3 - w1)*(float)(y1 - y0)/(float)(x1 - x0)/ar + w2;
return w4;
}
void
testBug (void)
{
ASSERT (m(0, 0) < 0);
}
|