um, hey all, this is really confusing me. does anyone know of any common errors or bugs in the javascript engine itself that could be mucking with numbers? maybe it is internet explorer's javascript that is at fault?
hmmm.
i've narrowed the bug down to the following code at the bottom of the post.
my question is, why does it return 0.60000000001 after multiplying 6 * 0.1 ??? it returns 0.5 when you change intminutes to 5, and have it multiply 5 * 0.1.
i wasnt able to get around the error by detecting the strange numbers and subtracting 0.00000001 or whatever, and also i could not convert it to a string and clip it with substr or substring (it returned something like 1~E68e90.8734 or an equally strange response)
this is very obnoxious. please help!
----------------
<script language="Javascript">
intminutes = 6
inthours = intminutes / 60;
cost = (intminutes * 0.1);
amsg = cost;
alert(amsg);
</script>
hmmm.
i've narrowed the bug down to the following code at the bottom of the post.
my question is, why does it return 0.60000000001 after multiplying 6 * 0.1 ??? it returns 0.5 when you change intminutes to 5, and have it multiply 5 * 0.1.
i wasnt able to get around the error by detecting the strange numbers and subtracting 0.00000001 or whatever, and also i could not convert it to a string and clip it with substr or substring (it returned something like 1~E68e90.8734 or an equally strange response)
this is very obnoxious. please help!
----------------
<script language="Javascript">
intminutes = 6
inthours = intminutes / 60;
cost = (intminutes * 0.1);
amsg = cost;
alert(amsg);
</script>