summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormartynas <>2008-09-13 22:48:45 +0000
committermartynas <>2008-09-13 22:48:45 +0000
commit404f42e023f74f798d3e32269dc691e855f21e4c (patch)
treedfea5495a34ac92b7fe984aa58d91a942486c3fa
parent6a07d35d454e3b3e1263e40935ee70899dbeb92f (diff)
downloadopenbsd-404f42e023f74f798d3e32269dc691e855f21e4c.tar.gz
openbsd-404f42e023f74f798d3e32269dc691e855f21e4c.tar.bz2
openbsd-404f42e023f74f798d3e32269dc691e855f21e4c.zip
document strtold. ok millert@
-rw-r--r--src/lib/libc/stdlib/Makefile.inc4
-rw-r--r--src/lib/libc/stdlib/strtod.332
2 files changed, 25 insertions, 11 deletions
diff --git a/src/lib/libc/stdlib/Makefile.inc b/src/lib/libc/stdlib/Makefile.inc
index ab8bd39f07..c149aeef0a 100644
--- a/src/lib/libc/stdlib/Makefile.inc
+++ b/src/lib/libc/stdlib/Makefile.inc
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile.inc,v 1.40 2008/09/07 20:36:08 martynas Exp $ 1# $OpenBSD: Makefile.inc,v 1.41 2008/09/13 22:48:45 martynas Exp $
2 2
3# stdlib sources 3# stdlib sources
4.PATH: ${LIBCSRCDIR}/arch/${MACHINE_ARCH}/stdlib ${LIBCSRCDIR}/stdlib 4.PATH: ${LIBCSRCDIR}/arch/${MACHINE_ARCH}/stdlib ${LIBCSRCDIR}/stdlib
@@ -64,7 +64,7 @@ MLINKS+=random.3 srandom.3 random.3 srandomdev.3
64MLINKS+=rand48.3 drand48.3 rand48.3 erand48.3 rand48.3 lrand48.3 64MLINKS+=rand48.3 drand48.3 rand48.3 erand48.3 rand48.3 lrand48.3
65MLINKS+=rand48.3 mrand48.3 rand48.3 nrand48.3 rand48.3 jrand48.3 65MLINKS+=rand48.3 mrand48.3 rand48.3 nrand48.3 rand48.3 jrand48.3
66MLINKS+=rand48.3 srand48.3 rand48.3 seed48.3 rand48.3 lcong48.3 66MLINKS+=rand48.3 srand48.3 rand48.3 seed48.3 rand48.3 lcong48.3
67MLINKS+=strtod.3 strtof.3 67MLINKS+=strtod.3 strtof.3 strtod.3 strtold.3
68MLINKS+=strtol.3 strtoll.3 strtol.3 strtoq.3 strtol.3 strtoimax.3 68MLINKS+=strtol.3 strtoll.3 strtol.3 strtoq.3 strtol.3 strtoimax.3
69MLINKS+=strtoul.3 strtoull.3 strtoul.3 strtouq.3 strtoul.3 strtoumax.3 69MLINKS+=strtoul.3 strtoull.3 strtoul.3 strtouq.3 strtoul.3 strtoumax.3
70MLINKS+=tsearch.3 tfind.3 70MLINKS+=tsearch.3 tfind.3
diff --git a/src/lib/libc/stdlib/strtod.3 b/src/lib/libc/stdlib/strtod.3
index 5f97639d8d..f1fc781f7d 100644
--- a/src/lib/libc/stdlib/strtod.3
+++ b/src/lib/libc/stdlib/strtod.3
@@ -29,17 +29,18 @@
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE. 30.\" SUCH DAMAGE.
31.\" 31.\"
32.\" $OpenBSD: strtod.3,v 1.13 2008/09/13 22:25:49 martynas Exp $ 32.\" $OpenBSD: strtod.3,v 1.14 2008/09/13 22:48:45 martynas Exp $
33.\" 33.\"
34.Dd $Mdocdate: September 13 2008 $ 34.Dd $Mdocdate: September 13 2008 $
35.Dt STRTOD 3 35.Dt STRTOD 3
36.Os 36.Os
37.Sh NAME 37.Sh NAME
38.Nm strtod , 38.Nm strtod ,
39.Nm strtof 39.Nm strtof ,
40.Nm strtold
40.Nd convert 41.Nd convert
41.Tn ASCII 42.Tn ASCII
42string to double or float 43string to double, float or long double
43.Sh SYNOPSIS 44.Sh SYNOPSIS
44.Fd #include <math.h> 45.Fd #include <math.h>
45.Fd #include <stdlib.h> 46.Fd #include <stdlib.h>
@@ -48,6 +49,9 @@ string to double or float
48.Pp 49.Pp
49.Ft float 50.Ft float
50.Fn strtof "const char *nptr" "char **endptr" 51.Fn strtof "const char *nptr" "char **endptr"
52.Pp
53.Ft long double
54.Fn strtold "const char *nptr" "char **endptr"
51.Sh DESCRIPTION 55.Sh DESCRIPTION
52The 56The
53.Fn strtod 57.Fn strtod
@@ -63,6 +67,13 @@ function converts the initial portion of the string pointed to by
63to 67to
64.Li float 68.Li float
65representation. 69representation.
70The
71.Fn strtold
72function converts the initial portion of the string pointed to by
73.Fa nptr
74to
75.Li long double
76representation.
66.Pp 77.Pp
67The expected form of the string is an optional plus 78The expected form of the string is an optional plus
68.Pq Ql + 79.Pq Ql +
@@ -81,9 +92,10 @@ Leading whitespace characters in the string (as defined by the
81function) are skipped. 92function) are skipped.
82.Sh RETURN VALUES 93.Sh RETURN VALUES
83The 94The
84.Fn strtod 95.Fn strtod ,
85and
86.Fn strtof 96.Fn strtof
97and
98.Fn strtold
87functions return the converted value, if any. 99functions return the converted value, if any.
88.Pp 100.Pp
89If 101If
@@ -123,9 +135,11 @@ Overflow or underflow occurred.
123.Sh STANDARDS 135.Sh STANDARDS
124The 136The
125.Fn strtod 137.Fn strtod
126function conform to 138function conforms to
127.St -ansiC-89 139.St -ansiC-89 .
128and 140The
129.Fn strtof 141.Fn strtof
130conform to 142and
143.Fn strtold
144functions conform to
131.St -ansiC-99 . 145.St -ansiC-99 .