trunc

Section: C Library Functions (3)
Updated: 15 décembre 2022
Index Return to Main Contents
 

NOM

trunc, truncf, truncl - Arrondir à l'entier le plus proche vers zéro  

BIBLIOTHÈQUE

Bibliothèque de math (libm, -lm)  

SYNOPSIS

#include <math.h>

double trunc(double x);
float truncf(float x);
long double truncl(long double x);

Exigences de macros de test de fonctionnalités pour la glibc (consulter feature_test_macros(7)) :

trunc(), truncf(), truncl() :

    _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
 

DESCRIPTION

Ces fonctions arrondissent xà la valeur entière la plus proche qui n'est pas plus grande en magnitude que x.  

VALEUR RENVOYÉE

Ces fonctions renvoient la valeur entière arrondie en format à virgule flottante.

Si x est un nombre entier, infini ou NaN, la valeur renvoyée est x lui-même.  

ERREURS

Aucune erreur ne survient.  

VERSIONS

Ces fonctions ont été ajoutées dans la glibc 2.1.  

ATTRIBUTS

Pour une explication des termes utilisés dans cette section, consulter attributes(7).
InterfaceAttributValeur
trunc(), truncf(), truncl() Sécurité des threadsMT-Safe

 

STANDARDS

C99, POSIX.1-2001, POSIX.1-2008.  

NOTES

La partie entière renvoyée par ces fonctions peut être trop grande pour être stockée dans un type entier (int, long, etc.). Pour éviter les dépassements, qui produiront des résultats indéfinis, une application devrait vérifier la validité de la valeur renvoyée avec l'intervalle accepté avant de l'affecter à un type entier.  

VOIR AUSSI

ceil(3), floor(3), lrint(3), nearbyint(3), rint(3), round(3)

 

TRADUCTION

La traduction française de cette page de manuel a été créée par Christophe Blaess <https://www.blaess.fr/christophe/>, Stéphan Rafin <stephan.rafin@laposte.net>, Thierry Vignaud <tvignaud@mandriva.com>, François Micaux, Alain Portal <aportal@univ-montp2.fr>, Jean-Philippe Guérard <fevrier@tigreraye.org>, Jean-Luc Coulon (f5ibh) <jean-luc.coulon@wanadoo.fr>, Julien Cristau <jcristau@debian.org>, Thomas Huriaux <thomas.huriaux@gmail.com>, Nicolas François <nicolas.francois@centraliens.net>, Florentin Duneau <fduneau@gmail.com>, Simon Paillard <simon.paillard@resel.enst-bretagne.fr>, Denis Barbier <barbier@debian.org>, David Prévot <david@tilapin.org>, Cédric Boutillier <cedric.boutillier@gmail.com> et Jean-Pierre Giraud <jean-pierregiraud@neuf.fr>

Cette traduction est une documentation libre ; veuillez vous reporter à la GNU General Public License version 3 concernant les conditions de copie et de distribution. Il n'y a aucune RESPONSABILITÉ LÉGALE.

Si vous découvrez un bogue dans la traduction de cette page de manuel, veuillez envoyer un message à


 

Index

NOM
BIBLIOTHÈQUE
SYNOPSIS
DESCRIPTION
VALEUR RENVOYÉE
ERREURS
VERSIONS
ATTRIBUTS
STANDARDS
NOTES
VOIR AUSSI
TRADUCTION

This document was created by man2html, using the manual pages.
Time: 06:00:45 GMT, May 23, 2024