Sign in Join
Wiki copytemporary

Mod/fr: what changed

Revision 2 to 3. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11Mod (**mod**ulo) calcule le reste entier de la division de deux entiers. Par exemple, l'expression "a:= 13 mod 4;" évaluera à 1 (a=1), alors que "b := 12 mod 4;" évaluera à 0 (b=0).
22
33cf [language reference](http://www.freepascal.org/docs-html/ref/refsu29.html):
44
55
66Le signe du résultat de l'opérateur Mod est celui de son opérande de gauche (dividende), en effet, cet opérateur est équivalent à l'expression suivante :
77
8-` I mod J = I - (I div J) * J `
8+```text
9+ I mod J = I - (I div J) * J
10+```
911
1012Par exemple, "c := -13 mod 4;" results in c = -1.
1113
1214Mais c'est ce que fait Delphi. La norme Pascal ISO 7185 spécifie:
1315
1416
1517L'évaluation d'un terme de la forme x mod y est une erreur si y est négatif ou nul; sinon c'est un entier k tel que x mod y satisfait la relation suivante :
1618
17-` 0 <= x mod y = x - k * y < y.`
19+```text
20+ 0 <= x mod y = x - k * y < y.
21+```
1822
1923## See also
2024
2125- [[Div/fr|Div]]
2226
2327---
2428*From the Free Pascal wiki, page "Mod/fr", as it stood on 2016-08-19 after a change by E-ric, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*
2529Category: FPC/fr
2630Category: Pascal/fr
2731Category: Reserved words/fr

Back to history