diff options
author | Martynas Venckus <martynas@cvs.openbsd.org> | 2008-07-29 18:19:18 +0000 |
---|---|---|
committer | Martynas Venckus <martynas@cvs.openbsd.org> | 2008-07-29 18:19:18 +0000 |
commit | a64b535c9a9210d9af1ab236f51f46a0a078a273 (patch) | |
tree | 924fb702b525f939882b82f47fe9b1801ef7c6f2 /lib/libc | |
parent | 81b1f09d1719de6b92cbf326f820093887979231 (diff) |
- man pages for fpclassify, isfinite, isinf, isnan, isnormal, signbit,
mostly from freebsd
- also describe deprecated aliases for isinff, isnanf, finite,
finitef
- describe behavior on vax
- add mlinks for finite, finitef, isfinite, isinf, isinff, isnan,
isnanf, isnormal, signbit
- add man pages for isgreater, isgreaterequal, isless, islessequal,
islessgreater, isunordered; from freebsd
looked over by jmc@, it's better for him to work on when they are in tree
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/gen/Makefile.inc | 34 | ||||
-rw-r--r-- | lib/libc/gen/fpclassify.3 | 167 | ||||
-rw-r--r-- | lib/libc/gen/isgreater.3 | 107 |
3 files changed, 293 insertions, 15 deletions
diff --git a/lib/libc/gen/Makefile.inc b/lib/libc/gen/Makefile.inc index 5c52fa86a42..92e82753fe7 100644 --- a/lib/libc/gen/Makefile.inc +++ b/lib/libc/gen/Makefile.inc @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.inc,v 1.42 2008/07/24 09:31:07 martynas Exp $ +# $OpenBSD: Makefile.inc,v 1.43 2008/07/29 18:19:17 martynas Exp $ # gen sources .PATH: ${LIBCSRCDIR}/arch/${MACHINE_ARCH}/gen ${LIBCSRCDIR}/gen @@ -47,19 +47,19 @@ errlst.o errlst.po: MAN+= alarm.3 auth_subr.3 authenticate.3 basename.3 clock.3 confstr.3 \ ctermid.3 ctype.3 daemon.3 devname.3 directory.3 dirname.3 err.3 \ - exec.3 fnmatch.3 fpgetmask.3 frexp.3 ftok.3 fts.3 ftw.3 getbsize.3 \ - getcap.3 getcwd.3 getdomainname.3 getdiskbyname.3 getfsent.3 \ - getgrent.3 getgrouplist.3 gethostname.3 getloadavg.3 getmntinfo.3 \ - getnetgrent.3 getpagesize.3 getpass.3 getpwent.3 getttyent.3 \ - getusershell.3 glob.3 initgroups.3 isalnum.3 isalpha.3 isascii.3 \ - isblank.3 iscntrl.3 isdigit.3 isfdtype.3 isgraph.3 isinf.3 islower.3 \ - isprint.3 ispunct.3 isspace.3 isupper.3 isxdigit.3 ldexp.3 lockf.3 \ - login_cap.3 modf.3 nice.3 nlist.3 pause.3 popen.3 psignal.3 pw_dup.3 \ - pwcache.3 raise.3 readpassphrase.3 scandir.3 setjmp.3 setmode.3 \ - setproctitle.3 siginterrupt.3 signal.3 sigsetops.3 sleep.3 statvfs.3 \ - sysconf.3 sysctl.3 strtofflags.3 syslog.3 time.3 times.3 timezone.3 \ - toascii.3 tolower.3 toupper.3 ttyname.3 ualarm.3 uname.3 unvis.3 \ - usleep.3 utime.3 valloc.3 vis.3 + exec.3 fnmatch.3 fpclassify.3 fpgetmask.3 frexp.3 ftok.3 fts.3 ftw.3 \ + getbsize.3 getcap.3 getcwd.3 getdomainname.3 getdiskbyname.3 \ + getfsent.3 getgrent.3 getgrouplist.3 gethostname.3 getloadavg.3 \ + getmntinfo.3 getnetgrent.3 getpagesize.3 getpass.3 getpwent.3 \ + getttyent.3 getusershell.3 glob.3 initgroups.3 isalnum.3 isalpha.3 \ + isascii.3 isblank.3 iscntrl.3 isdigit.3 isfdtype.3 isgraph.3 \ + isgreater.3 islower.3 isprint.3 ispunct.3 isspace.3 isupper.3 \ + isxdigit.3 ldexp.3 lockf.3 login_cap.3 modf.3 nice.3 nlist.3 pause.3 \ + popen.3 psignal.3 pw_dup.3 pwcache.3 raise.3 readpassphrase.3 \ + scandir.3 setjmp.3 setmode.3 setproctitle.3 siginterrupt.3 signal.3 \ + sigsetops.3 sleep.3 statvfs.3 sysconf.3 sysctl.3 strtofflags.3 \ + syslog.3 time.3 times.3 timezone.3 toascii.3 tolower.3 toupper.3 \ + ttyname.3 ualarm.3 uname.3 unvis.3 usleep.3 utime.3 valloc.3 vis.3 MLINKS+=auth_subr.3 auth_open.3 auth_subr.3 auth_call.3 auth_subr.3 \ auth_challenge.3 auth_subr.3 auth_check_change.3 auth_subr.3 \ @@ -83,13 +83,15 @@ MLINKS+=err.3 verr.3 err.3 errx.3 err.3 verrx.3 err.3 warn.3 err.3 vwarn.3 \ err.3 warnx.3 err.3 vwarnx.3 MLINKS+=exec.3 execl.3 exec.3 execle.3 exec.3 execlp.3 exec.3 execv.3 \ exec.3 execvp.3 +MLINKS+=fpclassify.3 finite.3 fpclassify.3 finitef.3 fpclassify.3 isfinite.3 \ + fpclassify.3 isinf.3 fpclassify.3 isinff.3 fpclassify.3 isnan.3 \ + fpclassify.3 isnanf.3 fpclassify.3 isnormal.3 fpclassify.3 signbit.3 MLINKS+=fpgetmask.3 fpgetround.3 fpgetmask.3 fpgetsticky.3 \ fpgetmask.3 fpsetmask.3 fpgetmask.3 fpsetround.3 \ fpgetmask.3 fpsetsticky.3 MLINKS+=fts.3 fts_open.3 fts.3 fts_read.3 fts.3 fts_children.3 \ fts.3 fts_set.3 fts.3 fts_close.3 MLINKS+=ftw.3 nftw.3 -MLINKS+=isinf.3 isnan.3 isinf.3 isnanf.3 isinf.3 isinff.3 MLINKS+=getcap.3 cgetcap.3 getcap.3 cgetclose.3 getcap.3 cgetent.3 \ getcap.3 cgetfirst.3 getcap.3 cgetmatch.3 getcap.3 cgetnext.3 \ getcap.3 cgetnum.3 getcap.3 cgetset.3 getcap.3 cgetstr.3 \ @@ -110,6 +112,8 @@ MLINKS+=getpwent.3 getpwnam_r.3 getpwent.3 getpwuid_r.3 MLINKS+=getttyent.3 endttyent.3 getttyent.3 getttynam.3 getttyent.3 setttyent.3 MLINKS+=getusershell.3 endusershell.3 getusershell.3 setusershell.3 MLINKS+=glob.3 globfree.3 +MLINKS+=isgreater.3 isgreaterequal.3 isgreater.3 isless.3 isgreater.3 \ + islessequal.3 isgreater.3 islessgreater.3 isgreater.3 isunordered.3 MLINKS+=login_cap.3 login_getclass.3 login_cap.3 login_getstyle.3 login_cap.3 \ login_getcapbool.3 login_cap.3 login_getcapnum.3 login_cap.3 \ login_getcapsize.3 login_cap.3 login_getcapstr.3 login_cap.3 \ diff --git a/lib/libc/gen/fpclassify.3 b/lib/libc/gen/fpclassify.3 new file mode 100644 index 00000000000..7febce0f982 --- /dev/null +++ b/lib/libc/gen/fpclassify.3 @@ -0,0 +1,167 @@ +.\" $OpenBSD: fpclassify.3,v 1.1 2008/07/29 18:19:17 martynas Exp $ +.\" +.\" Copyright (c) 2003 Mike Barcroft <mike@FreeBSD.org> +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD: src/lib/libc/gen/fpclassify.3,v 1.6 2005/01/27 05:46:16 das Exp $ +.\" +.Dd $Mdocdate: July 29 2008 $ +.Dt FPCLASSIFY 3 +.Os +.Sh NAME +.Nm fpclassify , +.Nm isfinite , +.Nm isinf , +.Nm isnan , +.Nm isnormal , +.Nm signbit +.Nd "classify a floating-point number" +.Sh SYNOPSIS +.In math.h +.Ft int +.Fn fpclassify "real-floating x" +.Ft int +.Fn isfinite "real-floating x" +.Ft int +.Fn isinf "real-floating x" +.Ft int +.Fn isnan "real-floating x" +.Ft int +.Fn isnormal "real-floating x" +.Ft int +.Fn signbit "real-floating x" +.Sh DESCRIPTION +The +.Fn fpclassify +macro takes an argument of +.Fa x +and returns one of the following manifest constants. +.Bl -tag -width ".Dv FP_SUBNORMAL" +.It Dv FP_INFINITE +Indicates that +.Fa x +is an infinite number. +.It Dv FP_NAN +Indicates that +.Fa x +is not a number (NaN). +.It Dv FP_NORMAL +Indicates that +.Fa x +is a normalized number. +.It Dv FP_SUBNORMAL +Indicates that +.Fa x +is a denormalized number. +.It Dv FP_ZERO +Indicates that +.Fa x +is zero (0 or \-0). +.El +.Pp +The +.Fn isfinite +macro returns a non-zero value if and only if its argument has +a finite (zero, subnormal, or normal) value. +.Pp +The +.Fn isinf , +.Fn isnan , +and +.Fn isnormal +macros return non-zero if and only if +.Fa x +is an infinity, NaN, +or a non-zero normalized number, respectively. +.Pp +The +.Fn signbit +macro takes an argument of +.Fa x +and returns non-zero if the value of its sign is negative, otherwise 0. +.Sh SEE ALSO +.Xr isgreater 3 , +.Xr math 3 +.Sh STANDARDS +The +.Fn fpclassify , +.Fn isfinite , +.Fn isinf , +.Fn isnan , +.Fn isnormal , +and +.Fn signbit +macros conform to +.St -isoC-99 . +.Pp +The symbols +.Fn isinff , +and +.Fn isnanf +are provided as compatibility aliases to +.Fn isinf , +and +.Fn isnan , +respectively, and their uses are deprecated. +Similarly, +.Fn finite +and +.Fn finitef +are deprecated versions of +.Fn isfinite . +.Sh HISTORY +The +.Fn fpclassify , +.Fn isfinite , +.Fn isinf , +.Fn isnan , +.Fn isnormal , +and +.Fn signbit +macros were added in +.Ox 4.4 . +.Bx 3 +introduced +.Fn isinf +and +.Fn isnan +functions, which accepted +.Vt double +arguments; these have been superseded by the macros +described above. +.Sh BUGS +.Tn VAX +floating point does not have distinguished values +for either infinity or not-a-number. +.Fn isinf , +.Fn isinff , +.Fn isnan , +and +.Fn isnanf +routines always return 0 on that architecture. +Similarly, +.Fn finite , +and +.Fn isfinite +always return 1. diff --git a/lib/libc/gen/isgreater.3 b/lib/libc/gen/isgreater.3 new file mode 100644 index 00000000000..97dc6804e6a --- /dev/null +++ b/lib/libc/gen/isgreater.3 @@ -0,0 +1,107 @@ +.\" $OpenBSD: isgreater.3,v 1.1 2008/07/29 18:19:17 martynas Exp $ +.\" +.\" Copyright (c) 2003 David Schultz <das@FreeBSD.ORG> +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD: src/lib/libc/gen/isgreater.3,v 1.3 2005/02/06 03:23:31 das Exp $ +.\" +.Dd $Mdocdate: July 29 2008 $ +.Dt ISGREATER 3 +.Os +.Sh NAME +.Nm isgreater , +.Nm isgreaterequal , +.Nm isless , +.Nm islessequal , +.Nm islessgreater , +.Nm isunordered +.Nd "compare two floating-point numbers" +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In math.h +.Ft int +.Fn isgreater "real-floating x" "real-floating y" +.Ft int +.Fn isgreaterequal "real-floating x" "real-floating y" +.Ft int +.Fn isless "real-floating x" "real-floating y" +.Ft int +.Fn islessequal "real-floating x" "real-floating y" +.Ft int +.Fn islessgreater "real-floating x" "real-floating y" +.Ft int +.Fn isunordered "real-floating x" "real-floating y" +.Sh DESCRIPTION +Each of the macros +.Fn isgreater , +.Fn isgreaterequal , +.Fn isless , +.Fn islessequal , +and +.Fn islessgreater +take arguments +.Fa x +and +.Fa y +and return a non-zero value if and only if its nominal +relation on +.Fa x +and +.Fa y +is true. +These macros always return zero if either +argument is not a number (NaN), but unlike the corresponding C +operators, they never raise a floating point exception. +.Pp +The +.Fn isunordered +macro takes arguments +.Fa x +and +.Fa y +and returns non-zero if and only if neither +.Fa x +nor +.Fa y +are NaNs. +For any pair of floating-point values, one +of the relationships (less, greater, equal, unordered) holds. +.Sh SEE ALSO +.Xr fpclassify 3 , +.Xr math 3 +.Sh STANDARDS +The +.Fn isgreater , +.Fn isgreaterequal , +.Fn isless , +.Fn islessequal , +.Fn islessgreater , +and +.Fn isunordered +macros conform to +.St -isoC-99 . +.Sh HISTORY +The relational macros described above first appeared in +.Ox 4.4 . |