Hello all. I’ve run into an Actionscript 3.0 problem recently that I can’t seem to figure out. The code is pretty simple. Where is this ‘000000000001’ comming from? :stare:
Thanks.
trace(array[0]); // 58.24
trace(array[1]); // 6.5
trace(array[2]); // 6.5
trace(array[3]); // 25
trace(array[4]); // 6.5
trace(array[5]); // 39.4
trace(array[6]); // 0
trace(array[7]); // 0
var counter:Number = 0;
var i:Number = 0;
for (i = 0; i <= 7; i++) {
if (counter <= 100) {
counter += array*;
if (counter >= 100) {
array* -= (counter - 100);
}
} else {
array* = 0;
}
trace (i + " " + counter);
}
Output:
0 58.24
1 64.74000000000001
2 71.24000000000001
3 96.24000000000001
4 102.74000000000001
5 102.74000000000001
6 102.74000000000001
7 102.74000000000001