Bug 98609 - MOD function does not work
Summary: MOD function does not work
Status: RESOLVED DUPLICATE of bug 88945
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Documentation (show other bugs)
(earliest affected) release
Hardware: All All
: medium normal
Assignee: Not Assigned
Depends on:
Reported: 2016-03-11 19:27 UTC by Brent
Modified: 2016-03-12 19:04 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:
Regression By:


Note You need to log in before you can comment on or make changes to this bug.
Description Brent 2016-03-11 19:27:08 UTC

Returns the remainder when one integer is divided by another.

MOD(Dividend; Divisor)

For integer arguments this function returns Dividend modulo Divisor, that is the remainder when Dividend is divided by Divisor.

This function is implemented as Dividend - Divisor * INT(Dividend/Divisor) , and this formula gives the result if the arguments are not integer.

=MOD(22;3) returns 1, the remainder when 22 is divided by 3.

=MOD(11.25;2.5) returns 1.25.

The results are not correct for a MOD function.  If the formula provided is truly the one being used then it is wrong.
A corrected formula would be (Dividend/Divisor)-INT(Dividend/Divisor)
That will give the remainder which is being searched for when using this math function.
Build ID: 55b006a02d247b5f7215fc6ea0fde844b30035b3
Locale: en-US (en_US)
Comment 1 Brent 2016-03-11 19:30:02 UTC
MOD(Dividend; Divisor)

This example is wrong.
The spreadsheet requires it to be MOD(Dividend,Divisor)
If a semi colon is used it is automatically replaced with a comma.
Comment 2 Joel Madero 2016-03-11 21:24:39 UTC
This just seems like a documentation error so I'm punting to them.
Comment 3 Regina Henschel 2016-03-12 17:55:54 UTC
Which separator is used between function arguments is a user setting in Tools > Options > LibreOffice Calc > Formula. The help texts always assume a semicolon as separator. Currently it is not possible to depend the help texts on the user setting, and there exists no plans to implement such feature.
Comment 4 Stanislav Horacek 2016-03-12 18:01:43 UTC
I suppose this can be marked as duplicate of a generic bug about argument separators in UI vs. in Help.

*** This bug has been marked as a duplicate of bug 88945 ***
Comment 5 Joel Madero 2016-03-12 18:05:40 UTC
If I read the issue right that was only one of the issues reported:

"This function is implemented as Dividend - Divisor * INT(Dividend/Divisor) , and this formula gives the result if the arguments are not integer."

"A corrected formula would be (Dividend/Divisor)-INT(Dividend/Divisor)"
Comment 6 Regina Henschel 2016-03-12 19:04:52 UTC
The MOD function is implemented same as in other spreadsheet applications like Excel, Gnumeric or Google tables and as the % operator in programming languages.

The suggestion of the reporter would give the fractional part of the quotient, but not the remainder. Perhaps the reporter confuses it with the function modf in C/C++.