summaryrefslogtreecommitdiff
path: root/src/lib/libc/stdlib/strtod.3
diff options
context:
space:
mode:
authorlandry <>2008-06-13 21:04:24 +0000
committerlandry <>2008-06-13 21:04:24 +0000
commit6b7d41f8c5a19961e127bc5168f899e7da8fee47 (patch)
treefc7d9970d453f9eddc142fd9d15084c181505b45 /src/lib/libc/stdlib/strtod.3
parentf8a6cc0c54595fc7b66a29e5c4423c6d2b6e9a3f (diff)
downloadopenbsd-6b7d41f8c5a19961e127bc5168f899e7da8fee47.tar.gz
openbsd-6b7d41f8c5a19961e127bc5168f899e7da8fee47.tar.bz2
openbsd-6b7d41f8c5a19961e127bc5168f899e7da8fee47.zip
Add strtof() to libc, some ports seem to like it. Currently it's a simple
call to strtod() with bounding check. Discussed with pyr@ and otto@ ok otto@ deraadt@
Diffstat (limited to 'src/lib/libc/stdlib/strtod.3')
-rw-r--r--src/lib/libc/stdlib/strtod.327
1 files changed, 21 insertions, 6 deletions
diff --git a/src/lib/libc/stdlib/strtod.3 b/src/lib/libc/stdlib/strtod.3
index 504307a624..3d8b2e07a0 100644
--- a/src/lib/libc/stdlib/strtod.3
+++ b/src/lib/libc/stdlib/strtod.3
@@ -29,21 +29,25 @@
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.10 2007/11/11 12:23:36 tobias Exp $ 32.\" $OpenBSD: strtod.3,v 1.11 2008/06/13 21:04:24 landry Exp $
33.\" 33.\"
34.Dd $Mdocdate: November 11 2007 $ 34.Dd $Mdocdate: June 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.Nd convert 40.Nd convert
40.Tn ASCII 41.Tn ASCII
41string to double 42string to double or float
42.Sh SYNOPSIS 43.Sh SYNOPSIS
43.Fd #include <math.h> 44.Fd #include <math.h>
44.Fd #include <stdlib.h> 45.Fd #include <stdlib.h>
45.Ft double 46.Ft double
46.Fn strtod "const char *nptr" "char **endptr" 47.Fn strtod "const char *nptr" "char **endptr"
48.Pp
49.Ft float
50.Fn strtof "const char *nptr" "char **endptr"
47.Sh DESCRIPTION 51.Sh DESCRIPTION
48The 52The
49.Fn strtod 53.Fn strtod
@@ -52,6 +56,13 @@ function converts the initial portion of the string pointed to by
52to 56to
53.Li double 57.Li double
54representation. 58representation.
59The
60.Fn strtof
61function converts the initial portion of the string pointed to by
62.Fa nptr
63to
64.Li float
65representation.
55.Pp 66.Pp
56The expected form of the string is an optional plus 67The expected form of the string is an optional plus
57.Pq Ql + 68.Pq Ql +
@@ -71,7 +82,9 @@ function) are skipped.
71.Sh RETURN VALUES 82.Sh RETURN VALUES
72The 83The
73.Fn strtod 84.Fn strtod
74function returns the converted value, if any. 85and
86.Fn strtof
87functions returns the converted value, if any.
75.Pp 88.Pp
76If 89If
77.Fa endptr 90.Fa endptr
@@ -110,5 +123,7 @@ Overflow or underflow occurred.
110.Sh STANDARDS 123.Sh STANDARDS
111The 124The
112.Fn strtod 125.Fn strtod
113function conforms to 126and
127.Fn strtof
128functions conforms to
114.St -ansiC . 129.St -ansiC .