1 /** Simple set of tests for floating pt.
7 # define FCOMP(a,b) (fabsf((a) - (b)) < ((b) * 1e-7))
9 /* Testing floats for equality is normally a bug,
10 but too keep this test simple we dare it. And
11 it works with the exception of the division on
13 # define FCOMP(a,b) ((a) == (b))
19 volatile float left, right;
23 ASSERT(left + right == 18);
24 ASSERT(left + right <= 18);
25 ASSERT(left + right >= 18);
26 ASSERT(left + right > 17.9);
27 ASSERT(left + right < 18.1);
33 #if defined (__mcs51) && !defined (SDCC_STACK_AUTO)
42 ASSERT(FCOMP(left/right, (17.0/343.0)));
43 ASSERT(FCOMP(right/left, (343.0/17.0)));
46 ASSERT(FCOMP(left/right, 1.0));
52 volatile float left, right, result;
56 result = left / right;
58 if (result > 0.999999)
74 if (result > 0.999999 && result < 1.00001)