peterinwa
03-05-2003, 10:47 PM
I have some very complex coding (for me!) that rounds numbers of less than one to two decimals, e.g., 0.68720 becomes 0.69.
To do this I multiply the number by 100 then round it, then divide it by 100. It words great, except that with WebTV with some (but not all numbers) when you divide by 100 it doesn't just move the decimal point but instead gives you a fraction.
I can by-pass all my code with a simple test: alert(69/100);
With IE I get 0.69, but with WebTV I get 0.689999...
I know this sounds like a browser problem and it probably is, but I'm such a self-taught JS novice that I wanted to post here to be sure I'm not doing something wrong. Or that I'm not wrong in expecting the result to be 0.69.
To do this I multiply the number by 100 then round it, then divide it by 100. It words great, except that with WebTV with some (but not all numbers) when you divide by 100 it doesn't just move the decimal point but instead gives you a fraction.
I can by-pass all my code with a simple test: alert(69/100);
With IE I get 0.69, but with WebTV I get 0.689999...
I know this sounds like a browser problem and it probably is, but I'm such a self-taught JS novice that I wanted to post here to be sure I'm not doing something wrong. Or that I'm not wrong in expecting the result to be 0.69.