diff options
author | landry <> | 2008-06-13 21:04:24 +0000 |
---|---|---|
committer | landry <> | 2008-06-13 21:04:24 +0000 |
commit | 6b7d41f8c5a19961e127bc5168f899e7da8fee47 (patch) | |
tree | fc7d9970d453f9eddc142fd9d15084c181505b45 /src/lib/libc/stdlib/strtod.3 | |
parent | f8a6cc0c54595fc7b66a29e5c4423c6d2b6e9a3f (diff) | |
download | openbsd-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.3 | 27 |
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 |
41 | string to double | 42 | string 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 |
48 | The | 52 | The |
49 | .Fn strtod | 53 | .Fn strtod |
@@ -52,6 +56,13 @@ function converts the initial portion of the string pointed to by | |||
52 | to | 56 | to |
53 | .Li double | 57 | .Li double |
54 | representation. | 58 | representation. |
59 | The | ||
60 | .Fn strtof | ||
61 | function converts the initial portion of the string pointed to by | ||
62 | .Fa nptr | ||
63 | to | ||
64 | .Li float | ||
65 | representation. | ||
55 | .Pp | 66 | .Pp |
56 | The expected form of the string is an optional plus | 67 | The 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 |
72 | The | 83 | The |
73 | .Fn strtod | 84 | .Fn strtod |
74 | function returns the converted value, if any. | 85 | and |
86 | .Fn strtof | ||
87 | functions returns the converted value, if any. | ||
75 | .Pp | 88 | .Pp |
76 | If | 89 | If |
77 | .Fa endptr | 90 | .Fa endptr |
@@ -110,5 +123,7 @@ Overflow or underflow occurred. | |||
110 | .Sh STANDARDS | 123 | .Sh STANDARDS |
111 | The | 124 | The |
112 | .Fn strtod | 125 | .Fn strtod |
113 | function conforms to | 126 | and |
127 | .Fn strtof | ||
128 | functions conforms to | ||
114 | .St -ansiC . | 129 | .St -ansiC . |