I have the following code:
console.log("1-"+parseFloat($('#pval').text().replace(',','.')));
console.log("2-"+parseFloat($('#pvig').text().replace(',','.')));
console.log("3-"+parseFloat($('#potr').text().replace(',','.')));
var aux = parseFloat($('#pval').text().replace(',','.'))+parseFloat($('#pvig').text().replace(',','.'))+parseFloat($('#potr').text().replace(',','.'));
console.log("4-"+aux);
Which returns :
1-1.5
2-2.52
3-0.18
4-4.199999999999999 //<-This is the problem
Why is this simple sum, losing 0.000000000001 ? How should I repair it? I already tried
aux=Math.round(aux*100)/100;
But itsn´t actually working.
Any help will be preciated.
The values of those camps
id(pval)=1,5
id(pvig)=2,69
id(potr)=0,18