Hello Robert,
>> The issue is that there are 3 definitions of modulo, two of which are fine
>> (Knuth floored division and Euclidian), and the last one much less useful.
>> Alas, C (%) & SQL (MOD) choose the bad definition:-( I really need any of
>> the other two. The attached patch adds all versions, with "%" and "mod"
>> consistent with their C and SQL unfortunate counterparts, and "fmod" and
>> "emod" the sane ones.
>
> Three different modulo operators seems like a lot for a language that
> doesn't even have a real expression syntax, but I'll yield to whatever
> the consensus is on this one.
I agree that it is overkill.
In fact there is a link: if there was a real expression syntax, the
remainder sign could be fixed afterwards, so the standard C/SQL version
would do. If it is not available, the modulo operator must be right.
If there is only one modulo added, I would rather have the Knuth version.
However I was afraid that someone would object if "%" does not return the
same result than the C/PostgreSQL versions (even if I think that nearly
nobody has a clue about what % returns when arguments are negative), hence
the 3 modulo version to counter this potential critic.
But I would prefer just one version with the Knuth (or Euclidian)
definitions.
--
Fabien.