summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdlib/strtod.3
diff options
context:
space:
mode:
authorlandry <landry@openbsd.org>2008-06-13 21:04:24 +0000
committerlandry <landry@openbsd.org>2008-06-13 21:04:24 +0000
commit8f9e5b6355fb3bcd00283e6a4e2b42a05bd7410a (patch)
treeb3540a2a4a4adeebe3db07fe9a4fd33e8cd7d703 /lib/libc/stdlib/strtod.3
parentImplement pbkdf2 in in bioctl to derive master key from a passphrase. (diff)
downloadwireguard-openbsd-8f9e5b6355fb3bcd00283e6a4e2b42a05bd7410a.tar.xz
wireguard-openbsd-8f9e5b6355fb3bcd00283e6a4e2b42a05bd7410a.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 'lib/libc/stdlib/strtod.3')
-rw-r--r--lib/libc/stdlib/strtod.327
1 files changed, 21 insertions, 6 deletions
diff --git a/lib/libc/stdlib/strtod.3 b/lib/libc/stdlib/strtod.3
index 504307a624a..3d8b2e07a0b 100644
--- a/lib/libc/stdlib/strtod.3
+++ b/lib/libc/stdlib/strtod.3
@@ -29,21 +29,25 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $OpenBSD: strtod.3,v 1.10 2007/11/11 12:23:36 tobias Exp $
+.\" $OpenBSD: strtod.3,v 1.11 2008/06/13 21:04:24 landry Exp $
.\"
-.Dd $Mdocdate: November 11 2007 $
+.Dd $Mdocdate: June 13 2008 $
.Dt STRTOD 3
.Os
.Sh NAME
-.Nm strtod
+.Nm strtod ,
+.Nm strtof
.Nd convert
.Tn ASCII
-string to double
+string to double or float
.Sh SYNOPSIS
.Fd #include <math.h>
.Fd #include <stdlib.h>
.Ft double
.Fn strtod "const char *nptr" "char **endptr"
+.Pp
+.Ft float
+.Fn strtof "const char *nptr" "char **endptr"
.Sh DESCRIPTION
The
.Fn strtod
@@ -52,6 +56,13 @@ function converts the initial portion of the string pointed to by
to
.Li double
representation.
+The
+.Fn strtof
+function converts the initial portion of the string pointed to by
+.Fa nptr
+to
+.Li float
+representation.
.Pp
The expected form of the string is an optional plus
.Pq Ql +
@@ -71,7 +82,9 @@ function) are skipped.
.Sh RETURN VALUES
The
.Fn strtod
-function returns the converted value, if any.
+and
+.Fn strtof
+functions returns the converted value, if any.
.Pp
If
.Fa endptr
@@ -110,5 +123,7 @@ Overflow or underflow occurred.
.Sh STANDARDS
The
.Fn strtod
-function conforms to
+and
+.Fn strtof
+functions conforms to
.St -ansiC .