Welcome to mirror list, hosted at ThFree Co, Russian Federation.

isgreater.c « common « libm « newlib - cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: bd4e95e056e1b969856700f011d50081199e1e7e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/* isgreater.c:  This file contains no source code, but rather only the
 * man-page comments.  All of the documented "functions" are actually macros
 * defined in math.h (q.v.).  */
/*
FUNCTION
<<isgreater>>, <<isgreaterequal>>, <<isless>>, <<islessequal>>, <<islessgreater>>, and <<isunordered>>--comparison macros
INDEX
	isgreater
INDEX
	isgreaterequal
INDEX
	isless
INDEX
	islessequal
INDEX
	islessgreater
INDEX
	isunordered

ANSI_SYNOPSIS
	#include <math.h>
	int isgreater(real-floating <[x]>, real-floating <[y]>);
	int isgreaterequal(real-floating <[x]>, real-floating <[y]>);
	int isless(real-floating <[x]>, real-floating <[y]>);
	int islessequal(real-floating <[x]>, real-floating <[y]>);
	int islessgreater(real-floating <[x]>, real-floating <[y]>);
	int isunordered(real-floating <[x]>, real-floating <[y]>);

DESCRIPTION
<<isgreater>>, <<isgreaterequal>>, <<isless>>, <<islessequal>>,
<<islessgreater>>, and <<isunordered>> are macros defined for use in
comparing floating-point numbers without raising any floating-point
exceptions.

The relational operators (i.e. <, >, <=, and >=) support the usual mathematical
relationships between numeric values.  For any ordered pair of numeric
values exactly one of the relationships--less, greater, and equal--is
true.  Relational operators may raise the "invalid" floating-point
exception when argument values are NaNs.  For a NaN and a numeric value, or
for two NaNs, just the unordered relationship is true (i.e., if one or both
of the arguments a NaN, the relationship is called unordered).  The specified
macros are quiet (non floating-point exception raising) versions of the
relational operators, and other comparison macros that facilitate writing
efficient code that accounts for NaNs without suffering the "invalid"
floating-point exception.  In the synopses shown, "real-floating" indicates
that the argument is an expression of real floating type.

Please note that saying that the macros do not raise floating-point
exceptions, it is referring to the function that they are performing.  It
is certainly possible to give them an expression which causes an exception.
For example:
o+
o	NaN < 1.0
		causes an "invalid" exception,
o	isless(NaN, 1.0)
		does not, and
o	isless(NaN*0., 1.0)
		causes an exception due to the "NaN*0.", but not from the
resultant reduced comparison of isless(NaN, 1.0).
o-

RETURNS
@comment Formatting note:  "$@" forces a new line
No floating-point exceptions are raised for any of the macros.@*
The <<isgreater>> macro returns the value of (x) > (y).@*
The <<isgreaterequal>> macro returns the value of (x) >= (y).@*
The <<isless>> macro returns the value of (x) < (y).@*
The <<islessequal>> macro returns the value of (x) <= (y).@*
The <<islessgreater>> macro returns the value of (x) < (y) || (x) > (y).@*
The <<isunordered>> macro returns 1 if either of its arguments is NaN and 0 otherwise.

PORTABILITY
C99, POSIX.

*/