.\" 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. .\" .\" 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. .\" .\" @(#)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, strold, aeb, 2001-06-07 .\" .\" Translated 2000 from man-pages 1.29 by Jos Boersema .\" Translation completed and updated to man-pages 1.45 by Joost van Baal, .\" Wed, 19 Dec 2001 19:00:27 +0100 .\" Email naar . .\" .\" $Id: strtod.3,v 1.1 2003/04/28 18:43:36 bokkie Exp $ .\" .TH STRTOD 3 2001-06-07 "Linux" "Bibliotheek functies" .SH NAAM strtod, strtof, strtold \- zet ASCII string om naar floating point number .SH BESCHRIJVING .B #include .sp .BI "double strtod(const char *" nptr ", char **" endptr ); .br .BI "float strtof(const char *" nptr ", char **" endptr ); .br .BI "long double strtold(const char *" nptr ", char **" endptr ); .SH BESCHRIJVING De .BR strtod , .BR strof , en .BR strold functies zetten het eerste deel van de string waar .I nptr naar wijst om in respectievelijk een .BR double , .BR float , en .B long double voorstelling. De verwachte vorm voor (het eerste deel van) de string is eventuele voorafgaande witruimte zoals herkend door \fIis\%space\fP(3), een optioneel plus (``+'') of min (``-'') teken, gevolgd door ofwel (i) een decimaal getal, ofwel (ii) een hexadecimaal getal, ofwel (iii) een oneindigheid ofwel (iv) een NAN (not-a-number, geen-getal). .LP Een .I "decimaal getal" bestaat uit een niet-lege rij van decimale cijfers, mogelijk een radix karakter (een locale-afhankelijke decimale punt, gewoonlijk ``.''), mogelijk gevolgd door een decimale exponent. Een decimale exponent bestaat uit een ``E'' of ``e'' karakter, gevolgd door een optioneel plus of min teken, gevolgd door een niet-lege serie van decimale cijfers, en geeft vermenigvuldiging met een macht van 10 aan. .LP Een .I "hexadecimaal getal" bestaat uit een ``0x'' of ``0X'' gevolgd door een niet-lege rij van hexadecimale cijfers, mogelijk bevattend een radix karakter, mogelijk gevolgd door een binaire exponent. Een binaire exponent bestaat uit een ``P'' of een ``p'', gevolgd door een optioneel plus- of min-teken, gevolgd door een niet-lege rij van decimale getallen, en geeft een vermenigvuldiging met een macht van 2 aan. Ten minste één van het radix karakter en de binaire exponent moeten aanwezig zijn. .LP Een .I oneindigheid is òf ``INF'' òf ``INFINITY''; op gebruik van hoofd- of kleine letters wordt niet gelet. .LP Een .I NAN is ``NAN'' (op gebruik van hoofd- of kleine letters wordt niet gelet) optioneel gevolgd door `(', een serie van karakters, gevolgd door `)'. De serie karakters geeft op een implementatie-afhankelijke manier het type van de NAN aan. .SH "EIND WAARDE" Deze functies geven de omgezette waarde terug, als die er is. Als .I endptr niet .B NULL is, dan wordt een pointer naar het karakter direct achter het laatste in de conversie gebruikte karakter opgeslagen op de locatie waar .I endptr naar wijst. Als geen conversie gedaan is, dat wordt nul teruggegeven, en de waarde van .I nptr is opgeslagen in de locatie waar .I endptr naar wijst. Als de correcte waarde overflow zou veroorzaken, dan wordt plus of minus .B HUGE_VAL .RB ( HUGE_VALF , .BR HUGE_VALL ) teruggegeven (afhankelijk van het teken van de waarde), en .B ERANGE wordt gezet in .IR errno . Als de correcte waarde underflow zou veroorzaken, dan wordt nul teruggegeven en .B ERANGE wordt gezet in .IR errno . .SH FOUTEN .TP .B ERANGE Overflow of underflow trad op. .SH "VOLDOET AAN" ANSI C beschrijft .BR strtod , C99 beschrijft de andere twee functies. .SH "ZIE OOK" .BR atof (3), .BR atoi (3), .BR atol (3), .BR strtol (3), .BR strtoul (3)