# The MOD function in Filemaker (11) - inconsistency?

Question asked by hugall1998 on Jun 28, 2013
Latest reply on Jul 3, 2013 by hugall1998

Hi all,

I needed to use the MOD function in my current solution so I decided to freshen my memory and looked it up in the HELP in FM 11 (windows).

The definition is clear [ Mod ( number; divisor) ] and the examples understandable until I encountered the following:

Mod( 7;-5) returns -3 (note, the divisor is minus 5)

In my mind, the return (the remainder) ought to be 2, not - 3 (minus 3), see the table below, row 11.

I searched for answers on the FM forum but found nothing applicable and after searching and some reading on the wide web the following assumptions emerged:

... The outcome (DIVISOR times multiplier) must be the closest value below the NUMBER

... The multiplier must be an integer (whole number) and can be 0 (zero)

... In case of a negative sign, a -30 is lower than -20

Also, there seem to be different definitions around, Java, C++ and other various programming languages are not always in agreement.

Excel (2010, win) gives the same results and Filemaker 11 (win).

I made the following table, using the examples in the Filemaker HELP (for win, vers. 11), please take a look at the rows 10 and 11, and 14 and 15. I find the remainder in rows 11 and 15 respectively, more logical than the answers that both Filemaker and Excel (see the column to the right) give as the correct ones (rows 10 and 14).

In the right lower corner I included in a small table the results from Filemaker (I set up the fields with the mod function, giving the remainder. The "multiplier" to the right of the remainder uses the DIV function, I display it to compare with the multiplier in the excel table above).

I guess it is a sacrilege to doubt the almightly Filemaker (:-) but is the example in the HELP file correct? Math is not my strongest point, especially with negative numbers and as result I'm missing something vital, so I appreciate a hard look from your experienced eyes. If the definition and/or assumptions above are incorrect I'd be grateful for corrections.

many thanks

Larus Jon