[solved]Why Number function sometimes gets some unpredictable real parts?
-
I am using javascript Number function to convert string to real from textField.text. I have made to textField.text can only accept number like 80.3 which mean only have 1 decimal from the decimal point.
However, I find sometimes the conversion is not always what I want. For example, when I input 80.2 in the textField, the conversion is 80.2. However, when I input 88.7, I will get 88.69999694824219.
So I have to use Math.round() to deal with what Number() gets.
My question is, is that Number() are always not trustable that we should always use a round() dealing with it? I also want to know why this happened?
-
I find this. http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html =.=||
-
That is a good reference. Thanks for the link!