xref: /freebsd/lib/libc/gen/isgreater.3 (revision fa9896e082a1046ff4fbc75fcba4d18d1f2efc19)
162486687SUlrich Spörlein.\" Copyright (c) 2003 David Schultz <das@FreeBSD.org>
25d62092fSMike Barcroft.\" All rights reserved.
35d62092fSMike Barcroft.\"
45d62092fSMike Barcroft.\" Redistribution and use in source and binary forms, with or without
55d62092fSMike Barcroft.\" modification, are permitted provided that the following conditions
65d62092fSMike Barcroft.\" are met:
75d62092fSMike Barcroft.\" 1. Redistributions of source code must retain the above copyright
85d62092fSMike Barcroft.\"    notice, this list of conditions and the following disclaimer.
95d62092fSMike Barcroft.\" 2. Redistributions in binary form must reproduce the above copyright
105d62092fSMike Barcroft.\"    notice, this list of conditions and the following disclaimer in the
115d62092fSMike Barcroft.\"    documentation and/or other materials provided with the distribution.
125d62092fSMike Barcroft.\"
135d62092fSMike Barcroft.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
145d62092fSMike Barcroft.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
155d62092fSMike Barcroft.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
165d62092fSMike Barcroft.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
175d62092fSMike Barcroft.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
185d62092fSMike Barcroft.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
195d62092fSMike Barcroft.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
205d62092fSMike Barcroft.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
215d62092fSMike Barcroft.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
225d62092fSMike Barcroft.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
235d62092fSMike Barcroft.\" SUCH DAMAGE.
245d62092fSMike Barcroft.\"
255d62092fSMike Barcroft.Dd February 12, 2003
265d62092fSMike Barcroft.Dt ISGREATER 3
275d62092fSMike Barcroft.Os
285d62092fSMike Barcroft.Sh NAME
295d62092fSMike Barcroft.Nm isgreater , isgreaterequal , isless , islessequal ,
305d62092fSMike Barcroft.Nm islessgreater , isunordered
315d62092fSMike Barcroft.Nd "compare two floating-point numbers"
325d62092fSMike Barcroft.Sh LIBRARY
335d62092fSMike Barcroft.Lb libc
345d62092fSMike Barcroft.Sh SYNOPSIS
355d62092fSMike Barcroft.In math.h
365d62092fSMike Barcroft.Ft int
375d62092fSMike Barcroft.Fn isgreater "real-floating x" "real-floating y"
385d62092fSMike Barcroft.Ft int
395d62092fSMike Barcroft.Fn isgreaterequal "real-floating x" "real-floating y"
405d62092fSMike Barcroft.Ft int
415d62092fSMike Barcroft.Fn isless "real-floating x" "real-floating y"
425d62092fSMike Barcroft.Ft int
435d62092fSMike Barcroft.Fn islessequal "real-floating x" "real-floating y"
445d62092fSMike Barcroft.Ft int
455d62092fSMike Barcroft.Fn islessgreater "real-floating x" "real-floating y"
465d62092fSMike Barcroft.Ft int
475d62092fSMike Barcroft.Fn isunordered "real-floating x" "real-floating y"
485d62092fSMike Barcroft.Sh DESCRIPTION
495d62092fSMike BarcroftEach of the macros
505d62092fSMike Barcroft.Fn isgreater ,
515d62092fSMike Barcroft.Fn isgreaterequal ,
525d62092fSMike Barcroft.Fn isless ,
535d62092fSMike Barcroft.Fn islessequal ,
545d62092fSMike Barcroftand
555d62092fSMike Barcroft.Fn islessgreater
565d62092fSMike Barcrofttake arguments
570e35e492SRuslan Ermilov.Fa x
585d62092fSMike Barcroftand
590e35e492SRuslan Ermilov.Fa y
605d62092fSMike Barcroftand return a non-zero value if and only if its nominal
615d62092fSMike Barcroftrelation on
620e35e492SRuslan Ermilov.Fa x
635d62092fSMike Barcroftand
640e35e492SRuslan Ermilov.Fa y
655d62092fSMike Barcroftis true.
665d62092fSMike BarcroftThese macros always return zero if either
670e35e492SRuslan Ermilovargument is not a number (NaN), but unlike the corresponding C
685d62092fSMike Barcroftoperators, they never raise a floating point exception.
695d62092fSMike Barcroft.Pp
705d62092fSMike BarcroftThe
715d62092fSMike Barcroft.Fn isunordered
725d62092fSMike Barcroftmacro takes arguments
730e35e492SRuslan Ermilov.Fa x
745d62092fSMike Barcroftand
750e35e492SRuslan Ermilov.Fa y
76*518e4554SEitan Adlerand returns non-zero if and only if any of
770e35e492SRuslan Ermilov.Fa x
78*518e4554SEitan Adleror
790e35e492SRuslan Ermilov.Fa y
805d62092fSMike Barcroftare NaNs.
815d62092fSMike BarcroftFor any pair of floating-point values, one
825d62092fSMike Barcroftof the relationships (less, greater, equal, unordered) holds.
835d62092fSMike Barcroft.Sh SEE ALSO
845d62092fSMike Barcroft.Xr fpclassify 3 ,
855d62092fSMike Barcroft.Xr math 3 ,
865d62092fSMike Barcroft.Xr signbit 3
875d62092fSMike Barcroft.Sh STANDARDS
885d62092fSMike BarcroftThe
895d62092fSMike Barcroft.Fn isgreater ,
905d62092fSMike Barcroft.Fn isgreaterequal ,
915d62092fSMike Barcroft.Fn isless ,
925d62092fSMike Barcroft.Fn islessequal ,
935d62092fSMike Barcroft.Fn islessgreater ,
945d62092fSMike Barcroftand
955d62092fSMike Barcroft.Fn isunordered
965d62092fSMike Barcroftmacros conform to
975d62092fSMike Barcroft.St -isoC-99 .
985d62092fSMike Barcroft.Sh HISTORY
995d62092fSMike BarcroftThe relational macros described above first appeared in
1005d62092fSMike Barcroft.Fx 5.1 .
101