Nicolas Alvarez wrote:
> The problem with doing #declare V=V+1/100; is that it might not reach
> 1.0000 exactly at the end of the loop (because of floating point
> inaccuracies), so it might run one time too many.
Or even if it runs runs the correct number of times, it may have slightly
off values. And errors would *accumulate*.
Tested in Python:
>>> x = 0;
>>> for i in range(0,100):
... x += 1.0/100;
...
>>> print x;
1.0000000000000007
>>>
Post a reply to this message
|