i @all,
in “Macro using MOD and variables produces wrong answer” @icsheepnwntr wrote:
‘You seem to assume MOD in Basic is the same thing as function MOD() in Calc formula. That’s not the case.’
and he’s right, afais MOD() in a sheet works with fractions (’=MOD(3;1,5)’ → ‘0’), while MOD in macros (basic) uses integers (‘print 3 MOD 1.5’ → ‘1’ (‘1.5’ is rounded to ‘2’, and the leftover is ‘1’)).
such is at least ‘irritating simple minded users’ and thus - imho - not ‘user friendly’.
the help page cited in the other thread “help page for mod” states ‘Returns the remainder when one integer is divided by another.’, and then explains the implementation which gives fractional results for fractions, which seems to work differently for macros (basic, don’t know how python or other dialects do).
does anyone have a good idea how to make this more harmonious to avoid such irritations? and / or how to avoid that every now and then users produce garbage results when they try calculations in the sheet and then want to automate them with macros?