scout1idf — 2011-04-07T03:09:53-04:00 — #1
Now on to my problem.....
I've been using a for loop to speed up repetitive tasks and it seems to work great, till now.
for (count=0;count<30;count+=2.4) //2.4 doesn't work consistently//
The results I get start out correct then go wrong.
FireFox (3.6.16)____________________Results with IE 8____________________Results with Opera
If I use...
for (count=0;count<30;count+=1) //1, 2, 3, etc.. works fine//
for (count=0;count<30;count+=1.5) //1.5 works fine//
It counts like it should.
So why is it when I use "2.4" it doesn't count properly?
And why does it produce different results in different browsers?
oblig — 2011-04-07T05:56:31-04:00 — #2
You could use this hacky addition to sort the rounding out:
scout1idf — 2011-04-07T11:25:31-04:00 — #3
That worked for me. Thank You.
It still doesn't make sense why it doesn't work without the fix and why different browsers give different results.
Again, thank you.
Another suggestion I got was to use....
Which works as well, just has a permanent float which is not a problem (for this project).
paul_wilkins — 2011-04-07T19:22:22-04:00 — #4
You're right, it doesn't make sense.
Here's an article that can help to explain why.
Why I Love ECMAScript 4: Real Decimals
scout1idf — 2011-04-08T00:28:12-04:00 — #5
Thanks for the help. Still kinda Greek to me, but it helped.
oblig — 2011-04-08T04:58:40-04:00 — #6
Nice link. Will be interesting to see if the rounding or 1DP solutions above remain quicker than the proposed decimal types.