C programming
Hi the list,
I apologize if that is a little bit off topic but I am a bit puzzled
and I know there are experts on this list. I would like an
explanation on why the two "for" below give different results.
Thanks,
ChriS
-.¸¸.·´¯`·.¸¸.-.¸¸.·´¯`·.¸¸.-.¸¸.·´¯`·.¸¸.-.¸¸.·´¯`·.¸¸.-.¸¸.·´¯`·.¸¸.-
#include <stdio.h>
main()
{
double x, y, z;
int t;
for(x=.5, y=1./4., t=1; z= x + y, z > x; y /=2, t++)
;
printf("t=%i\n", t);
for(x=.5, y=1./4., t=1; x+y > x; y /=2, t++)
;
printf("t=%i\n", t);
}
Reply to: