https://bugs.freedesktop.org/show_bug.cgi?id=80732

--- Comment #2 from Jean-Baptiste Faure <jbf.fa...@sud-ouest.org> ---
Created attachment 102047
  --> https://bugs.freedesktop.org/attachment.cgi?id=102047&action=edit
augmented version of test spreadsheet

I agree that the current behavior is due to a limitation of the floating point
calculations on the current computer technology. That said it is possible to
workaround the problem in the case of MOD() function by changing its algorithm.
For example by computing MOD(X;Y) = X-ROUND(X/Y)*Y
Using INT(X/Y) instead of ROUND(X/Y) gives the same problem as the current
algorithm because in some cases the quotient X/Y is inferior by one unit to the
correct value due to the fact INT(A) make a truncation to the greatest integer
less than A instead of a rounding to the nearest integer as ROUND() does.

There is the same problem with the QUOTIENT() function. Computing it by
QUOTIENT(X;Y) = ROUND(X/Y) gives the correct results when computing it by
INT(X/Y) gives the same errors.

Please have a look at the second sheet of the new version of the attachment. In
column F you can check that the computed values are always near zero: select
the column and verify that the sum in the status bar is small.

Best regards. JBF

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs

Reply via email to