If I enter 5.99 in first box and 5.11 in second I get 11.100000000000001 as a result, it should be 11.1. Any one know why or a work around?
Here is a simple copy of what I'm doing.
i1 = text1.value - 0 ;
i2 = text2.value - 0;
text3.value = (i1 + i2);
<INPUT type="text" id=text1 name=text1 onchange="fnTotal()"><BR>
<INPUT type="text" id=text2 name=text2 onchange="fnTotal()"><BR>
<INPUT type="text" id=text3 name=text3><BR>
Floating point precision errors... not much you can do about it, really. Happens in most languages. Best you can do is to format your numbers so that the effect of the errors is minimized.
Thanks, I'll just round it.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)