in reply to Re: When is a 2 not a 2?
in thread When is a 2 not a 2?
int(2.1) is 2, which is <= 2, so the loop won't end then like it should. This is a completely different bug than the OP's.
You were maybe thinking something more along the lines of int($x*10)/10 <= 2, but that would only work with some combination of numbers. int($x*10+0.5)/10 <= 2 might be ok, but you'd still be needlessly accumulating error in your variable.
As already mentioned (although not in so many words), if you want to loop a certain number of times, count the number of loops passes and derive the decimal number from the loop pass number.
|
|---|