Hello,
I never thought someone could have problems adding two numbers, but I have them. Here's some sample code:
var op1 = "119.88"
var op1_1 = "7"
var op2 = "119.88"
var op2_2 = "4"
var res1 = parseFloat(op1) * parseInt(op1_1)
var res2 = parseFloat(op2) * parseInt(op2_2)
var result = res1 + res2
document.write(result)
The result must be 1318.68 but JavaScript returns 1318.67999999999998, where is the error?
Vars res1 and res2 are ok, the problem presents when I try to add them
Thanks
I never thought someone could have problems adding two numbers, but I have them. Here's some sample code:
var op1 = "119.88"
var op1_1 = "7"
var op2 = "119.88"
var op2_2 = "4"
var res1 = parseFloat(op1) * parseInt(op1_1)
var res2 = parseFloat(op2) * parseInt(op2_2)
var result = res1 + res2
document.write(result)
The result must be 1318.68 but JavaScript returns 1318.67999999999998, where is the error?
Vars res1 and res2 are ok, the problem presents when I try to add them
Thanks