Question
Flash can't add :)
What the hell is going on here:
The script below just adds 0.2 to a variable, and traces that variable...
From 22.8 and on, problems start to occur!
a = 0;
function bla() {
for (i=0; i<120; i++) {
a = a+0.2;
trace(i+": "+a);
}
}
bla();
Trace result:
108: 21.8
109: 22
110: 22.2
111: 22.4
112: 22.6
113: 22.7999999999999
114: 22.9999999999999
115: 23.1999999999999
116: 23.3999999999999
117: 23.5999999999999
118: 23.7999999999999
119: 23.9999999999999
Anyone???
The script below just adds 0.2 to a variable, and traces that variable...
From 22.8 and on, problems start to occur!
a = 0;
function bla() {
for (i=0; i<120; i++) {
a = a+0.2;
trace(i+": "+a);
}
}
bla();
Trace result:
108: 21.8
109: 22
110: 22.2
111: 22.4
112: 22.6
113: 22.7999999999999
114: 22.9999999999999
115: 23.1999999999999
116: 23.3999999999999
117: 23.5999999999999
118: 23.7999999999999
119: 23.9999999999999
Anyone???