Arithmetic errors on some field calculations

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:

Screen Shot 2021-07-11 at 11.16.24 AM

instead produces the following on the completed transaction:

Screen Shot 2021-07-11 at 11.16.37 AM

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., 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.

Fixed in the latest version (21.7.15)

@lubos this fix is causing problems with currency exchange rates see Exchange rate shown incorrect due to round up. Please help as this is problematic.

Or round to a precision consistent with the internal number representation.

Fix precision works well when adding units of currency. But not as well with other algebra operations.

Sounds like a prior issue

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