.\" -*- coding: UTF-8 -*- .\" Copyright (c) 1990, 1991 The Regents of the University of California. .\" All rights reserved. .\" .\" This code is derived from software contributed to Berkeley by .\" the American National Standards Committee X3, on Information .\" Processing Systems. .\" .\" %%%LICENSE_START(BSD_4_CLAUSE_UCB) .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" %%%LICENSE_END .\" .\" @(#)strtod.3 5.3 (Berkeley) 6/29/91 .\" .\" Modified Sun Aug 21 17:16:22 1994 by Rik Faith (faith@cs.unc.edu) .\" Modified Sat May 04 19:34:31 MET DST 1996 by Michael Haardt .\" (michael@cantor.informatik.rwth-aachen.de) .\" Added strof, strtold, aeb, 2001-06-07 .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .TH STRTOD 3 "1 novembre 2020" Linux "Manuel du programmeur Linux" .SH NOM strtod, strtof, strtold \- Convertir une chaîne ASCII en nombre à virgule flottante .SH SYNOPSIS \fB#include \fP .PP \fBdouble strtod(const char *\fP\fInptr\fP\fB, char **\fP\fIendptr\fP\fB);\fP .br \fBfloat strtof(const char *\fP\fInptr\fP\fB, char **\fP\fIendptr\fP\fB);\fP .br \fBlong double strtold(const char *\fP\fInptr\fP\fB, char **\fP\fIendptr\fP\fB);\fP .PP .RS -4 Exigences de macros de test de fonctionnalités pour la glibc (consulter \fBfeature_test_macros\fP(7))\ : .RE .ad l .PP \fBstrtof\fP(), \fBstrtold\fP()\ : .RS 4 _ISOC99_SOURCE || _POSIX_C_SOURCE\ >=\ 200112L .RE .ad .SH DESCRIPTION Les fonctions \fBstrtod\fP(), \fBstrtof\fP() et \fBstrtold\fP() convertissent la portion initiale de la chaîne pointée par \fInptr\fP en un réel de type \fIdouble\fP, \fIfloat\fP, et \fIlong double\fP respectivement. .PP La (portion initiale de la) chaîne attendue est de la forme suivante\ : des espaces éventuels en tête, ou des caractères interprétés comme tels par \fBisspace\fP(3), un éventuel signe plus («\ +\ ») ou moins («\ \-\ »), et ensuite soit (1) un nombre décimal, soit (2) un nombre hexadécimal, soit (3) un infini, soit (4) un non nombre \fBNAN\fP (not\-a\-number). .PP Un \fInombre décimal\fP consiste en une séquence non vide de chiffres décimaux, pouvant contenir un point décimal (dépendant de la localisation, mais habituellement «\ .\ »), suivi éventuellement d'un exposant décimal. Ce dernier est constitué d'un «\ E\ » ou «\ e\ » suivi éventuellement du signe plus ou du signe moins, puis d’une séquence non vide de chiffres décimaux, indiquant la multiplication par une puissance de \fB10\fP. .PP Un \fInombre hexadécimal\fP commence «\ 0x\ » ou «\ 0X\ », suivi d'une séquence non vide de chiffres hexadécimaux, pouvant contenir un point décimal suivi éventuellement d'un exposant binaire. Ce dernier est constitué d'un «\ P\ » ou «\ p\ » suivi éventuellement du signe plus ou du signe moins, puis d’une séquence non vide de chiffres décimaux, indiquant la multiplication par une puissance de deux. Au moins un point ou un exposant binaire doit être présent. .PP Un \fIinfini\fP est soit «\ INF\ », soit «\ INFINITY\ », sans tenir compte des différences entre majuscules et minuscules. .PP Un \fInon\-nombre\fP est «\ NAN\ » (sans tenir compte de la casse) suivi éventuellement d'une chaîne \fI(n\-char\-sequence)\fP, où \fIn\-char\-sequence\fP indique d'une façon dépendante de l'implémentation le type de \fBNAN\fP (consultez NOTES). .SH "VALEUR RENVOYÉE" Ces fonctions renvoient la valeur convertie si c'est possible. .PP Si \fIendptr\fP n'est pas NULL, un pointeur sur le caractère suivant le dernier caractère converti est stocké dans l'emplacement pointé par \fIendptr\fP. .PP Si aucune conversion n'est possible, la fonction renvoie zéro, et (à moins que \fIendptr\fP soit NULL) la valeur de \fInptr\fP est stockée dans \fIendptr\fP. .PP Si la valeur convertie déclenche un débordement (overflow), la fonction renvoie plus ou moins \fBHUGE_VAL\fP, \fBHUGE_VALF\fP ou \fBHUGE_VALL\fP (en fonction du type de retour et du signe de la valeur) et \fIerrno\fP contient \fBERANGE\fP. .PP Si la valeur convertie déclenche un débordement inférieur (underflow), la fonction renvoie une valeur de grandeur inférieure à \fBDBL_MIN\fP, \fBFLT_MIN\fP ou \fBLDBL_MIN\fP et \fIerrno\fP contient \fBERANGE\fP. .SH ERREURS .TP \fBERANGE\fP Débordement. .SH ATTRIBUTS Pour une explication des termes utilisés dans cette section, consulter \fBattributes\fP(7). .TS allbox; lbw29 lb lb l l l. Interface Attribut Valeur T{ \fBstrtod\fP(), \fBstrtof\fP(), \fBstrtold\fP() T} Sécurité des threads MT\-Safe locale .TE .SH CONFORMITÉ POSIX.1\-2001, POSIX.1\-2008, C99. .PP \fBstrtod\fP() était également décrit dans la norme C89. .SH NOTES Comme la valeur \fB0\fP peut légitimement être renvoyée à la fois en cas de succès et d'échec, le programme appelant doit positionner \fIerrno\fP à \fB0\fP avant l'appel, et déterminer si une erreur s'est produite en regardant si \fIerrno\fP a une valeur non nulle après l'appel. .PP .\" From glibc 2.8's stdlib/strtod_l.c: .\" We expect it to be a number which is put in the .\" mantissa of the number. .\" It looks as though at least FreeBSD (according to the manual) does .\" something similar. .\" C11 says: "An implementation may use the n-char sequence to determine .\" extra information to be represented in the NaN's significant." Dans l'implémentation qui en est faite par la glibc, la \fIn\-char\-sequence\fP qui suit \fBNAN\fP est interprétée comme un nombre entier (avec un préfixe «\ 0\ » ou «\ 0x\ » optionnel pour sélectionner la base \fB8\fP ou \fB16\fP) placé dans la mantisse de la valeur retournée. .SH EXEMPLES Consultez l'exemple dans la page de manuel \fBstrtol\fP(3)\ ; l'utilisation des fonctions décrites dans cette page de manuel est identique. .SH "VOIR AUSSI" \fBatof\fP(3), \fBatoi\fP(3), \fBatol\fP(3), \fBnan\fP(3), \fBnanf\fP(3), \fBnanl\fP(3), \fBstrfromd\fP(3), \fBstrtol\fP(3), \fBstrtoul\fP(3) .SH COLOPHON Cette page fait partie de la publication\ 5.10 du projet \fIman\-pages\fP 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/. .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 et Grégoire Scano . 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. 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 .