Incorrect results of calculations in numerical fields are again appearing in some cases. For example, the following input, which should produce an exact result for unit price at 1 decimal place:
instead produces the following on the completed transaction:
This seems to occur on all transaction form types, but is inconsistent. The problem is similar to a bug fixed in 2019. However, the parameters of the problem do not seem quite the same, I could not reproduce some of the issues used to illustrate the previous bug report, but found others.
I don’t have access to Manager’s source code, but this looks very much like a common type of error that occurs when using floating point numbers to represent currencies because floats are just binary approximations of decimal numbers (See, e.g., https://wiki.c2.com/?FloatingPointCurrency). Best practice is generally to use either a fixed-point decimal type library, or integer representations where possible.
Yeah, the decimal precision is way beyond what’s useful. If you calculate say 11 digits and round back to 10, this should solve it. I don’t think anyone would need more precision even for currency conversion but I stand to be corrected.
What would help, would be an explanation of how Manager deals with calculations - how many decimal places does it work with and what limitations, if any, are there on inputting prices and what rounding, if any, is used