.\" -*- coding: UTF-8 -*- '\" t .\" Copyright 1993, David Metcalfe .\" Copyright, the authors of the Linux man-pages project .\" .\" SPDX-License-Identifier: Linux-man-pages-copyleft .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .TH fmod 3 "8 février 2026" "Pages du manuel de Linux 6.18" .SH NOM fmod, fmodf, fmodl \- Fonction modulo réel .SH BIBLIOTHÈQUE Bibliothèque de math (\fIlibm\fP,\ \fI\-lm\fP) .SH SYNOPSIS .nf \fB#include \fP .P \fBdouble fmod(double \fP\fIx\fP\fB, double \fP\fIy\fP\fB);\fP \fBfloat fmodf(float \fP\fIx\fP\fB, float \fP\fIy\fP\fB);\fP \fBlong double fmodl(long double \fP\fIx\fP\fB, long double \fP\fIy\fP\fB);\fP .fi .P .RS -4 Exigences de macros de test de fonctionnalités pour la glibc (consulter \fBfeature_test_macros\fP(7)) : .RE .P \fBfmodf\fP(), \fBfmodl\fP() : .nf _ISOC99_SOURCE || _POSIX_C_SOURCE\ >=\ 200112L || /* Depuis la glibc 2.19 : */ _DEFAULT_SOURCE || /* glibc <= 2.19 : */ _BSD_SOURCE || _SVID_SOURCE .fi .SH DESCRIPTION Ces fonctions calculent le reste, en virgule flottante, de la division de \fIx\fP par \fIy\fP. La valeur renvoyée est \fIx\fP \- \fIn\fP * \fIy\fP, où \fIn\fP est le quotient \fIx\fP / \fIy\fP, arrondi à l'entier inférieur en valeur absolue. .P Pour obtenir le modulo, plus précisément, le plus petit résidué positif, vous devez ajuster le résultat de \fBfmod\fP() de cette manière : .P .in +4n .nf z = fmod(x, y); if (z < 0) z += fabs(y); .fi .in .P Une autre manière pour exprimer cela est\fIfmod(fmod(x, y) + y, y)\fP, mais le second \fBfmod\fP() coûte habituellement beaucoup plus que la première branche. .SH "VALEUR RENVOYÉE" On success, these functions return the value \fIx\ \-\ n*y\fP, for some integer \fIn\fP, such that the returned value has the same sign as \fIx\fP and a magnitude less than the magnitude of \fIy\fP. .P Si \fIx\fP n’est pas un nombre, un \fBNaN\fP est renvoyé. .P Si \fIx\fP est une valeur infinie, une erreur de domaine est produite et un NaN est renvoyé. .P Si \fIy\fP vaut zéro, une erreur de domaine est produite et un NaN est renvoyé. .P Si \fIx\fP vaut +0 (resp. \-0), et \fIy\fP n'est pas nul, +0 (resp. \-0) est renvoyé. .SH ERREURS Voir \fBmath_error\fP(7) pour savoir comment déterminer si une erreur s'est produite lors de l'appel d'une de ces fonctions. .P Les erreurs suivantes peuvent se produire : .TP Domain error: \f[I]x\fR is an infinity \fIerrno\fP prend la valeur \fBEDOM\fP (mais consultez la section \fBBOGUES\fP). Une exception indiquant une virgule flottante incorrecte (\fBFE_INVALID\fP) est levée. .TP Domain error: \f[I]y\fR is zero .\" POSIX.1 documents an optional underflow error, but AFAICT it doesn't .\" (can't?) occur -- mtk, Jul 2008 \fIerrno\fP prend la valeur \fBEDOM\fP. Une exception de virgule flottante non valable (\fBFE_INVALID\fP) est levée. .SH ATTRIBUTS Pour une explication des termes utilisés dans cette section, consulter \fBattributes\fP(7). .TS allbox; lbx lb lb l l l. Interface Attribut Valeur T{ .na .nh \fBfmod\fP(), \fBfmodf\fP(), \fBfmodl\fP() T} Sécurité des threads MT\-Safe .TE .SH NORMES C11, POSIX.1\-2008. .SH HISTORIQUE C99, POSIX.1\-2001. .P La variante renvoyant \fIdouble\fP est également conforme à SVr4, 4.3BSD, C89. .SH BOGUES .\" https://www.sourceware.org/bugzilla/show_bug.cgi?id=6784 Avant la glibc 2.10, l'implémentation de la glibc ne définissait pas \fIerrno\fP à \fBEDOM\fP lorsqu'une erreur de domaine survenait pour un \fIx\fP infini. .SH EXEMPLES L'appel \fIfmod(372, 360)\fP renvoie 12. .P L'appel \fIfmod(\-372, 360)\fP renvoie \-12. .P L'appel \fIfmod(\-372, \-360)\fP renvoie aussi \-12. .SH "VOIR AUSSI" \fBremainder\fP(3) .PP .SH TRADUCTION La traduction française de cette page de manuel a été créée par Christophe Blaess , Stéphan Rafin , Thierry Vignaud , François Micaux, Alain Portal , Jean-Philippe Guérard , Jean-Luc Coulon (f5ibh) , Julien Cristau , Thomas Huriaux , Nicolas François , Florentin Duneau , Simon Paillard , Denis Barbier , David Prévot , Cédric Boutillier et Jean-Pierre Giraud . .PP Cette traduction est une documentation libre ; veuillez vous reporter à la .UR https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License version 3 .UE concernant les conditions de copie et de distribution. Il n'y a aucune RESPONSABILITÉ LÉGALE. .PP Si vous découvrez un bogue dans la traduction de cette page de manuel, veuillez envoyer un message à .MT debian-l10n-french@lists.debian.org .ME .