Browse Source

document strtold. ok millert@

OPENBSD_4_5
martynas 16 years ago
parent
commit
72651265ea
2 changed files with 25 additions and 11 deletions
  1. +2
    -2
      src/lib/libc/stdlib/Makefile.inc
  2. +23
    -9
      src/lib/libc/stdlib/strtod.3

+ 2
- 2
src/lib/libc/stdlib/Makefile.inc View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile.inc,v 1.40 2008/09/07 20:36:08 martynas Exp $
# $OpenBSD: Makefile.inc,v 1.41 2008/09/13 22:48:45 martynas Exp $
# stdlib sources
.PATH: ${LIBCSRCDIR}/arch/${MACHINE_ARCH}/stdlib ${LIBCSRCDIR}/stdlib
@ -64,7 +64,7 @@ MLINKS+=random.3 srandom.3 random.3 srandomdev.3
MLINKS+=rand48.3 drand48.3 rand48.3 erand48.3 rand48.3 lrand48.3
MLINKS+=rand48.3 mrand48.3 rand48.3 nrand48.3 rand48.3 jrand48.3
MLINKS+=rand48.3 srand48.3 rand48.3 seed48.3 rand48.3 lcong48.3
MLINKS+=strtod.3 strtof.3
MLINKS+=strtod.3 strtof.3 strtod.3 strtold.3
MLINKS+=strtol.3 strtoll.3 strtol.3 strtoq.3 strtol.3 strtoimax.3
MLINKS+=strtoul.3 strtoull.3 strtoul.3 strtouq.3 strtoul.3 strtoumax.3
MLINKS+=tsearch.3 tfind.3


+ 23
- 9
src/lib/libc/stdlib/strtod.3 View File

@ -29,17 +29,18 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $OpenBSD: strtod.3,v 1.13 2008/09/13 22:25:49 martynas Exp $
.\" $OpenBSD: strtod.3,v 1.14 2008/09/13 22:48:45 martynas Exp $
.\"
.Dd $Mdocdate: September 13 2008 $
.Dt STRTOD 3
.Os
.Sh NAME
.Nm strtod ,
.Nm strtof
.Nm strtof ,
.Nm strtold
.Nd convert
.Tn ASCII
string to double or float
string to double, float or long double
.Sh SYNOPSIS
.Fd #include <math.h>
.Fd #include <stdlib.h>
@ -48,6 +49,9 @@ string to double or float
.Pp
.Ft float
.Fn strtof "const char *nptr" "char **endptr"
.Pp
.Ft long double
.Fn strtold "const char *nptr" "char **endptr"
.Sh DESCRIPTION
The
.Fn strtod
@ -63,6 +67,13 @@ function converts the initial portion of the string pointed to by
to
.Li float
representation.
The
.Fn strtold
function converts the initial portion of the string pointed to by
.Fa nptr
to
.Li long double
representation.
.Pp
The expected form of the string is an optional plus
.Pq Ql +
@ -81,9 +92,10 @@ Leading whitespace characters in the string (as defined by the
function) are skipped.
.Sh RETURN VALUES
The
.Fn strtod
and
.Fn strtod ,
.Fn strtof
and
.Fn strtold
functions return the converted value, if any.
.Pp
If
@ -123,9 +135,11 @@ Overflow or underflow occurred.
.Sh STANDARDS
The
.Fn strtod
function conform to
.St -ansiC-89
and
function conforms to
.St -ansiC-89 .
The
.Fn strtof
conform to
and
.Fn strtold
functions conform to
.St -ansiC-99 .

Loading…
Cancel
Save