[fpc-devel] -1 mod 3

Schatzl Thomas tom_at_work at gmx.at
Wed Nov 5 18:23:13 CET 2008


Hello,

> Datum: Wed, 05 Nov 2008 18:04:01 +0100
> Von: "Vinzent Höfler" <JeLlyFish.software at gmx.net>
> > 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: (C99)

[...]

> Java:

[...]

> 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,

Just because it's called "remainder" in other languages (and if you had actually read the specs ;), the result in these languages is still the same as for the FPC "mod" operator.

E.g. both read, having the exact same wording in both specs, "...produces a result value such that (a/b)*b+(a%b) is equal to a."

I.e. for a=-1 and b=3 the result is -1 following from a%b = a - (a/b)*b for both C99 and Java.

SCNR, really, =)
  Thomas

-- 
GMX Download-Spiele: Preizsturz! Alle Puzzle-Spiele Deluxe über 60% billiger.
http://games.entertainment.gmx.net/de/entertainment/games/download/puzzle/index.html



More information about the fpc-devel mailing list