[Libreoffice-bugs] [Bug 141200] Basic MOD operator must have a mention that it rounds its operands

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Thu Apr 1 17:42:49 UTC 2021


https://bugs.documentfoundation.org/show_bug.cgi?id=141200

--- Comment #4 from Rafael Lima <rafael.palma.lima at gmail.com> ---
> you will get results consistent with VBA's.
> So the help should just reflect the correct intended result (rounding of
> both operands before Mod), and bug 141201 should resolve the inconsistency.

Hi Mike. Now I understood where the problem is. I initially thought VBA rounded
the remainder to the nearest integer. But from your explanation (and after
reading more carefully [2]) both VBA and LO Basic (if variables are used) first
round each variable to the nearest integer and then apply the MOD operator.

Here's the example to demonstrate this:

Sub ExampleMod2
   a = 16.4
   b = 5.9
   Print a Mod b 'Prints 4
End Sub

It should be noted that BASIC's MOD operator has a different behavior than
Calc's MOD function. In Calc =MOD(16.4;5.9) returns 4.6.

I'll update the help file to clarify these issues.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20210401/da4778b7/attachment.htm>


More information about the Libreoffice-bugs mailing list