I have an array of objects and i need to inject the sum of some objects. So i have this :
var details=[{month: 1,equips:32.1, instals:12.6, softs: 6.7, manuts:6.2, formacs: 9.7, total:0.0}]
An if i sum all the values to put the result in "total" i get a strange number (67.30000000000001) ...
I'm calculating "total" like this :
var i,nLines=details.length;
for(i=0;i<nLines;i++){
details[i].total=(details[i].equips)+(details[i].instals)+(details[i].softs)+(details[i].manuts)+(details[i].formacs);
}
And for some reason, on certain lines ( my array has more lines) my result has some strange decimals ... like the one that i mentioned ...
already tried parseFloat but i get the same weird result... and if i use .toFixed(1) i get " is not a function"