View Single Post
Old 2005-07-27, 14:35   #1
R.D. Silverman
 
R.D. Silverman's Avatar
 
Nov 2003

22×5×373 Posts
Thumbs up Bizarre!!!! Alert!!!!

Here is a snippet of code: (called in a loop that increments e)

if (e < lower_midpt) f_lower = round_double1(lm1 * (double)e + lc1 + .5);
else f_lower = round_double1(lm2 * (double)e + lc2 + .5);

if (e < lower_midpt) printf("LESS: \n");
else printf("MORE: \n");

if (e < lower_midpt) printf("LESS: %lf, %d\n",lower_midpt, e);
else printf("MORE: %lf %d\n", lower_midpt, e);

=========================================================
Here is some output

LESS:
LESS: -36.319540, -42
old_flower = 52
LESS:
LESS: -36.319540, -41
old_flower = 44
LESS:
LESS: -36.319540, -40
old_flower = 35
LESS:
LESS: -36.319540, -39
old_flower = 27
LESS:
LESS: -36.319540, -38
old_flower = 18
LESS:
LESS: -36.319540, -37
old_flower = 10
MORE:
MORE: -36.319540 -36
old_flower = 4
LESS:
MORE: -36.319540 -35
old_flower = 4
LESS:
MORE: -36.319540 -34
old_flower = 4
LESS:
MORE: -36.319540 -33
old_flower = 4
LESS:
MORE: -36.319540 -32
old_flower = 3
LESS:
MORE: -36.319540 -31
old_flower = 3
LESS:
MORE: -36.319540 -30
old_flower = 3
LESS:
MORE: -36.319540 -29
old_flower = 3
LESS:
MORE: -36.319540 -28


Would anyone care to explain this? As e increments from -36 to -35
suddenly the first comparison against midpt (-36.3) says -35 is less
than -36.3. But the second comparison gives a different answer.

I am not making this up!!!

Bob
R.D. Silverman is offline   Reply With Quote