|
|
SharkD <nomail@nomail> wrote:
> There should only be six!
You have found the inaccuracies of floating point numbers.
If you want an exact number of iterations, use integers, and at the
beginning of the loop, calculate the actual value you want to use from
that integer loop counter.
For example, assume you want a loop with a variable which goes from
0 to 1 at steps of 0.1, and stops before it reaches the 1. The correct
way to do that is:
#declare Index = 0;
#while(Index < 10)
#declare Value = Index/10;
... (the body of the loop here, which uses 'Value') ...
#declare Index = Index+1;
#end
This would be the *wrong* way of doing it:
#declare Value = 0;
#while(Value < 1)
...
#declare Value = Value + 0.1;
#end
--
- Warp
Post a reply to this message
|
|