Possible Duplicate:
Is JavaScript’s Floating-Point Math Broken?
In Javascript,
3 * 0.1 = 0.30000000000000004
I think this is due to the language's number system where 0.3 cannot be accurately represented. But why the following?
0.15 * 2 = 0.3
Similarly,
0.1 + 0.2 = 0.30000000000000004
But
0.15 + 0.15 = 0.3
How's so?