I'm trying to sum two values with decimals of two variables:
valor1 = 10.00;
valor2 = 10.99;
console.log(valor1+valor2);
Adding the two values returns 20.990000000000002
and not 20.99
.
When I add values with nonzero decimals, the result is accurate, for example:
valor1 = 10.03;
valor2 = 10.81;
console.log(valor1+valor2);
Why is the result of the first example not accurate?