C
craigslist.jg
Hi,
I'm building an IE-centric portal for an intranet so I've only had to
develop for IE 6+
My version is: 6.00290.2180
Here's what I'm seeing:
0.25 * 100 = 25
0.26 * 100 = 26
0.27 * 100 = 27
ok so far....
0.28 * 100 = 28.000000000000003
0.29 * 100 = 28.999999999999996
Not what I expected.
curiously, 0.299 yields what I'd expect, 29.9
Also, 0.299 * 1000 = 299, which is correct!
I iterated from 0.01 to 0.99 and these other combinations produce a
similar output:
0.07 * 100 = 7.000000000000001
0.14 * 100 = 14.000000000000001
0.55 * 100 = 55.00000000000001
0.56 * 100 = 56.00000000000001
0.57 * 100 = 56.99999999999999
0.58 * 100 = 57.99999999999999
Anyone know of a safe way of doing multiplication which will produce
the correct result and the right number of digits?
Thanks!
I'm building an IE-centric portal for an intranet so I've only had to
develop for IE 6+
My version is: 6.00290.2180
Here's what I'm seeing:
0.25 * 100 = 25
0.26 * 100 = 26
0.27 * 100 = 27
ok so far....
0.28 * 100 = 28.000000000000003
0.29 * 100 = 28.999999999999996
Not what I expected.
curiously, 0.299 yields what I'd expect, 29.9
Also, 0.299 * 1000 = 299, which is correct!
I iterated from 0.01 to 0.99 and these other combinations produce a
similar output:
0.07 * 100 = 7.000000000000001
0.14 * 100 = 14.000000000000001
0.55 * 100 = 55.00000000000001
0.56 * 100 = 56.00000000000001
0.57 * 100 = 56.99999999999999
0.58 * 100 = 57.99999999999999
Anyone know of a safe way of doing multiplication which will produce
the correct result and the right number of digits?
Thanks!