[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: C programming



To follow up: how floating point numbers are represented in the machine
during computations may vary slightly from how they get represented when
stored into a variable.  That is, the evaluation of (x+y) may have
greater numerical precision then the result of z = x + y.  In the second
case, there "appears" to be some loss of precision in the result and
therefore  z -> x faster than (x + y) -> x.

Disclaimer: I'm not a computer scientist!  However, the final value of
"y" in your first result is different then the final result of "y" in
the second case.  Check it out by adding "printf "y=%g\n".  You'll see
what I mean.

And by all means, don't use such icky for loops.
-- 
MegaHAL quote:
	I think a blowpipe is a marijuana cigarrette.  
	It'll get you deleted!



Reply to: