Possible Duplicate:
Is JavaScript's Math broken?
I have fount weird problem in arithmetic precision in OCaml. Look:
# 1.1+.2.2;;
- : float = 3.30000000000000027
It happen only when I do: something.1 + something.2. Could someone try it?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This is a reality of using floating-point values. While 1.1 is represented exactly in decimal with two digits, it takes an infinite number of binary digits to represent this value. Since you are are storing 1.1 in binary with a finite number of bits, rounding error occurs.