In my Angular application, I have the following TypeScript function:
countTotal() {
this.total = this.num1 + this.num2
}
The value of num1 is 110.84 and the value of num2 is 5.54. I determined these values by watching this.num1 and this.num2 in the Chrome debugger. Both num1 and num2 are number types.
After adding num1 and num2 together, the result is 116.38000000000001 instead of 116.38. Although I can round to 2 decimal places to achieve 116.38, I am curious about why JavaScript behaves this way.