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