A colleague of mine and I are running the "ceil" function in C and getting some wierd output. For example we run....
float q, k;
int r, s;
for (s=0; s <= 100; s++) {
q = (s/k) ;
r = ceil (q) ;
} ;
... We know from output that when k = .52 and s = 52, the program computes q = 100.00 and r = 100. That's good. But when k = .53 and s = 53, the program computes q = 100.00 and r = 101. That's weird.
Why would the ceil function round 100.00 to 100 in one case and 100.00 to 101 in another
case?
Thanks for your help,
-Keith
Assistant Professor
Florida International University
Miami, FL 33199