[fpc-devel] -1 mod 3

Vinzent Höfler JeLlyFish.software at gmx.net
Wed Nov 5 18:04:01 CET 2008


m2 wrote:
> Florian Klaempfl a écrit :
>> Dmitry Lizorkin schrieb:
>>>> I agree, no real life need.
>>> Except probably for my 150 students to whom i can no longer recommend
>>> FPC as a reference implementation.
>>
>> Hopefully they won't be schocked when being hit by another real world
>> programming language implementing mod like it is implemented in computer
>> science.
> 
> Unless they make use of Ada.

Which just has both, that's all. ;)

As an alternative one could read some other language reference manuals 
and notice that - surprisingly - at least two of the more common "real 
world languages" don't even have a "modulo" operation:

ISO/IEC9899:1999:

-- 8< --
6.5.5 Multiplicative operators

[...]

5 The result of the / operator is the quotient from the division of the 
first operand by the second; the result of the % operator is the 
remainder. [...]
-- 8< --

Java:

http://mindprod.com/jgloss/modulus.html
http://java.sun.com/docs/books/jls/third_edition/html/expressions.html#15.17.3


So, IMO somebody at Borland got it wrong, just because someone at Intel 
did it that way - and this has definitely and absolutely nothing to do 
with a "computer science implementation".


SCNR,

Vinzent.




More information about the fpc-devel mailing list