Every piece of software contains literals (usually numbers, strings or booleans). These are values related to application configuration, parts of the business logic, natural or language constants, etc.. We have learned to replace many of these values with variables, constants or function calls for various reasons (security, manageability, readability, expressivity,…), which we are not going…
Month: April 2020
Truncating decimals from summands and sum
This is a problem that you may have run into at some point. Especially, if you had to display or print the components of a price using less decimals than the decimals used for the calculations. Cutting-off decimals after the calculation has taken place can lead to inconsistency between the summands and the sum. In…