I have the following TypeScript function in an Angular app:
countTotal() {
this.total = this.num1 + this.num2
}
Where num1 value is 110.84 and num2 value is 5.54. I got these values by adding a watch of this.num1 and this.num2 in Chrome debugger respectively. num1 and num2 are of type number.
The result of this addition is 116.38000000000001 instead of 116.38. I need this value to be 116.38. I know that I can round to 2 decimal places but I need to understand why JavaScript is behaving this way.