Scroll to navigation

FREXP(3) Manuel du programmeur Linux FREXP(3)

NOM

frexp, frexpf, frexpl - Conversion de réel en fraction normalisée

SYNOPSIS

#include <math.h>
double frexp(double x, int *exp);
float frexpf(float x, int *exp);
long double frexpl(long double x, int *exp);

Éditer les liens avec -lm.

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

frexpf(), frexpl() :


_ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
|| /* Depuis la glibc 2.19 : */ _DEFAULT_SOURCE
|| /* Versions <= 2.19 de la glibc : */ _BSD_SOURCE || _SVID_SOURCE

DESCRIPTION

These functions are used to split the number x into a normalized fraction and an exponent which is stored in exp.

VALEUR RENVOYÉE

These functions return the normalized fraction. If the argument x is not zero, the normalized fraction is x times a power of two, and its absolute value is always in the range 1/2 (inclusive) to 1 (exclusive), that is, [0.5,1).

Si x est nul, la fraction normalisée vaut zéro et exp prend la valeur zéro.

Si x est un NaN (pas un nombre : « Not a Number »), un NaN est renvoyé et la valeur de *exp n'est pas spécifiée.

Si x est une valeur infinie positive (resp. négative), une valeur infinie positive (resp. négative) est renvoyée et la valeur de *exp n'est pas spécifiée.

ERREURS

Aucune erreur ne survient.

ATTRIBUTS

Pour une explication des termes utilisés dans cette section, consulter attributes(7).

Interface Attribut Valeur
frexp(), frexpf(), frexpl() Sécurité des threads MT-Safe

CONFORMITÉ

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

La variante renvoyant double est également conforme à SVr4, 4.3BSD et C89.

EXEMPLES

Le programme ci-dessous affiche les résultats suivants :


$ ./a.out 2560
frexp(2560, &e) = 0.625: 0.625 * 2^12 = 2560
$ ./a.out -4
frexp(-4, &e) = -0.5: -0.5 * 2^3 = -4

Source du programme

#include <math.h>
#include <float.h>
#include <stdio.h>
#include <stdlib.h>
int
main(int argc, char *argv[])
{

double x, r;
int exp;
x = strtod(argv[1], NULL);
r = frexp(x, &exp);
printf("frexp(%g, &e) = %g: %g * %d^%d = %g\n",
x, r, r, FLT_RADIX, exp, x);
exit(EXIT_SUCCESS); }

VOIR AUSSI

ldexp(3), modf(3)

COLOPHON

Cette page fait partie de la publication 5.13 du projet man-pages Linux. Une description du projet et des instructions pour signaler des anomalies et la dernière version de cette page peuvent être trouvées à l'adresse https://www.kernel.org/doc/man-pages/.

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> et Cédric Boutillier <cedric.boutillier@gmail.com>

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 à debian-l10n-french@lists.debian.org.

22 mars 2021