Sign in Join
Wiki copytemporary

Mod/fr: what changed

Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.

Title: Mod/fr

OldNewLine
1+Mod (**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).
2+
3+cf [language reference](http://www.freepascal.org/docs-html/ref/refsu29.html):
4+
5+
6+Le 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 :
7+
8+` I mod J = I - (I div J) * J `
9+
10+Par exemple, "c := -13 mod 4;" results in c = -1.
11+
12+Mais c'est ce que fait Delphi. La norme Pascal ISO 7185 spécifie:
13+
14+
15+L'é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 :
16+
17+` 0 <= x mod y = x - k * y < y.`
18+
19+## See also
20+
21+- [[Div/fr|Div]]
22+
23+\
24+
25+---
26+*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).*
27+Category: FPC/fr
28+Category: Pascal/fr
29+Category: Reserved words/fr

Back to history