0

I have a microflow that sums the invoiceline and compares it with the invoice total. But I now have an invoice where the sum of the invoiceline gives a result of 3161.272128 instead of 3161.27 If all the lines are currency values how can the aggregate sum of these currency values have extra decimals?

asked

Ronald Catersels

2 answers

2

This is the result of the innate inadequacy of computers (via binary data) to work with floats. Floating point - Accuracy problems.

The modeler and runtime try to enforce the decimal precision on currency but when you start calculating with them, it's best to include a round(total, 2) to make sure you get the same decimal precision as you started with. (Although the rounding in itself could lead to rounding differences)

answered

Robert van 't Hof

1

Other systems have a type Decimal for this purpose.

A way to emulate this is to use Long/Integer in the background to do all calculations with (exact calculations) and for presentation use a Float or String. Off course this needs a lot of extra programming.

answered

Bart Tolen