Print this page
11620 strtod man page typo equence
*** 42,56 ****
.\"
.\" Copyright 1989 AT&T
.\" Copyright (c) 1992, X/Open Company Limited. All Rights Reserved.
.\" Portions Copyright (c) 2006, Sun Microsystems, Inc. All Rights Reserved.
.\"
! .TH STRTOD 3C "Nov 1, 2003"
.SH NAME
strtod, strtof, strtold, atof \- convert string to floating-point number
.SH SYNOPSIS
- .LP
.nf
#include <stdlib.h>
\fBdouble\fR \fBstrtod\fR(\fBconst char *restrict\fR \fInptr\fR, \fBchar **restrict\fR \fIendptr\fR);
.fi
--- 42,55 ----
.\"
.\" Copyright 1989 AT&T
.\" Copyright (c) 1992, X/Open Company Limited. All Rights Reserved.
.\" Portions Copyright (c) 2006, Sun Microsystems, Inc. All Rights Reserved.
.\"
! .TH STRTOD 3C "Aug 25, 2019"
.SH NAME
strtod, strtof, strtold, atof \- convert string to floating-point number
.SH SYNOPSIS
.nf
#include <stdlib.h>
\fBdouble\fR \fBstrtod\fR(\fBconst char *restrict\fR \fInptr\fR, \fBchar **restrict\fR \fIendptr\fR);
.fi
*** 69,80 ****
.nf
\fBdouble\fR \fBatof\fR(\fBconst char *\fR\fIstr\fR);
.fi
.SH DESCRIPTION
- .sp
- .LP
The \fBstrtod()\fR, \fBstrtof()\fR, and \fBstrtold()\fR functions convert the
initial portion of the string pointed to by \fInptr\fR to \fBdouble\fR,
\fBfloat\fR, and \fBlong double\fR representation, respectively. First they
decompose the input string into three parts:
.RS +4
--- 68,77 ----
*** 147,157 ****
NAN/NAN(\fIn-char-sequence\fR) forms are recognized. In C99/SUSv3 mode,
hexadecimal strings are also recognized.
.sp
.LP
In default mode for \fBstrtod()\fR, the \fIn-char-sequence\fR in the
! NAN(\fIn-char-equence\fR) form can contain any character except ')' (right
parenthesis) or '\e0' (null). In C99/SUSv3 mode, the \fIn-char-sequence\fR can
contain only upper and lower case letters, digits, and '_' (underscore).
.sp
.LP
The \fBstrtof()\fR and \fBstrtold()\fR functions always function in
--- 144,154 ----
NAN/NAN(\fIn-char-sequence\fR) forms are recognized. In C99/SUSv3 mode,
hexadecimal strings are also recognized.
.sp
.LP
In default mode for \fBstrtod()\fR, the \fIn-char-sequence\fR in the
! NAN(\fIn-char-sequence\fR) form can contain any character except ')' (right
parenthesis) or '\e0' (null). In C99/SUSv3 mode, the \fIn-char-sequence\fR can
contain only upper and lower case letters, digits, and '_' (underscore).
.sp
.LP
The \fBstrtof()\fR and \fBstrtold()\fR functions always function in
*** 200,211 ****
.sp
.LP
The \fBatof(\fR\fIstr\fR\fB)\fR function call is equivalent to
\fBstrtod(\fR\fInptr\fR\fB, (char **)NULL)\fR.
.SH RETURN VALUES
- .sp
- .LP
Upon successful completion, these functions return the converted value. If no
conversion could be performed, \fB0\fR is returned.
.sp
.LP
If the correct value is outside the range of representable values,
--- 197,206 ----
*** 216,232 ****
.LP
If the correct value would cause an underflow, the correctly rounded result
(which may be normal, subnormal, or zero) is returned, a floating point
underflow exception is raised, and \fBerrno\fR is set to \fBERANGE\fR.
.SH ERRORS
- .sp
- .LP
These functions will fail if:
.sp
.ne 2
.na
! \fB\fBERANGE\fR\fR
.ad
.RS 10n
The value to be returned would cause overflow or underflow
.RE
--- 211,225 ----
.LP
If the correct value would cause an underflow, the correctly rounded result
(which may be normal, subnormal, or zero) is returned, a floating point
underflow exception is raised, and \fBerrno\fR is set to \fBERANGE\fR.
.SH ERRORS
These functions will fail if:
.sp
.ne 2
.na
! \fBERANGE\fR
.ad
.RS 10n
The value to be returned would cause overflow or underflow
.RE
*** 234,252 ****
.LP
These functions may fail if:
.sp
.ne 2
.na
! \fB\fBEINVAL\fR\fR
.ad
.RS 10n
No conversion could be performed.
.RE
.SH USAGE
- .sp
- .LP
Since 0 is returned on error and is also a valid return on success, an
application wishing to check for error situations should set \fBerrno\fR to 0,
then call \fBstrtod()\fR, \fBstrtof()\fR, or \fBstrtold()\fR, then check
\fBerrno\fR.
.sp
--- 227,243 ----
.LP
These functions may fail if:
.sp
.ne 2
.na
! \fBEINVAL\fR
.ad
.RS 10n
No conversion could be performed.
.RE
.SH USAGE
Since 0 is returned on error and is also a valid return on success, an
application wishing to check for error situations should set \fBerrno\fR to 0,
then call \fBstrtod()\fR, \fBstrtof()\fR, or \fBstrtold()\fR, then check
\fBerrno\fR.
.sp
*** 315,326 ****
.LP
The change in behavior is due to the inclusion of floating-point numbers in
hexadecimal notation without requiring that either a decimal point or the
binary exponent be present.
.SH ATTRIBUTES
- .sp
- .LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp
.sp
.TS
--- 306,315 ----
*** 335,351 ****
_
MT-Level MT-Safe with exceptions
.TE
.SH SEE ALSO
- .sp
- .LP
\fBisspace\fR(3C), \fBlocaleconv\fR(3C), \fBscanf\fR(3C), \fBsetlocale\fR(3C),
\fBstrtol\fR(3C), \fBattributes\fR(5), \fBstandards\fR(5)
.SH NOTES
- .sp
- .LP
The \fBstrtod()\fR and \fBatof()\fR functions can be used safely in
multithreaded applications, as long as \fBsetlocale\fR(3C) is not called to
change the locale.
.sp
.LP
--- 324,336 ----