When creating an ordering system (quantity x value) I noticed that in some cases when adding broken values, JavaScript returns numbers with many more decimal places than expected.
Example:
(123*1.23)+(312*3.26) //retorna 1168.4099999999999 ao invés de 1168.41
Is this a common behavior in JavaScript? Does not the fact that I am calculating values with only two decimal places should limit the result to only two houses? Is there any way to make the behavior return the expected value (eg, 1168.41
)?