1 /* isgreater.c: This file contains no source code, but rather only the 2 * man-page comments. All of the documented "functions" are actually macros 3 * defined in math.h (q.v.). */ 4 /* 5 FUNCTION 6 <<isgreater>>, <<isgreaterequal>>, <<isless>>, <<islessequal>>, <<islessgreater>>, and <<isunordered>>---comparison macros 7 INDEX 8 isgreater 9 INDEX 10 isgreaterequal 11 INDEX 12 isless 13 INDEX 14 islessequal 15 INDEX 16 islessgreater 17 INDEX 18 isunordered 19 20 ANSI_SYNOPSIS 21 #include <math.h> 22 int isgreater(real-floating <[x]>, real-floating <[y]>); 23 int isgreaterequal(real-floating <[x]>, real-floating <[y]>); 24 int isless(real-floating <[x]>, real-floating <[y]>); 25 int islessequal(real-floating <[x]>, real-floating <[y]>); 26 int islessgreater(real-floating <[x]>, real-floating <[y]>); 27 int isunordered(real-floating <[x]>, real-floating <[y]>); 28 29 DESCRIPTION 30 <<isgreater>>, <<isgreaterequal>>, <<isless>>, <<islessequal>>, 31 <<islessgreater>>, and <<isunordered>> are macros defined for use in 32 comparing floating-point numbers without raising any floating-point 33 exceptions. 34 35 The relational operators (i.e. <, >, <=, and >=) support the usual mathematical 36 relationships between numeric values. For any ordered pair of numeric 37 values exactly one of the relationships--less, greater, and equal--is 38 true. Relational operators may raise the "invalid" floating-point 39 exception when argument values are NaNs. For a NaN and a numeric value, or 40 for two NaNs, just the unordered relationship is true (i.e., if one or both 41 of the arguments a NaN, the relationship is called unordered). The specified 42 macros are quiet (non floating-point exception raising) versions of the 43 relational operators, and other comparison macros that facilitate writing 44 efficient code that accounts for NaNs without suffering the "invalid" 45 floating-point exception. In the synopses shown, "real-floating" indicates 46 that the argument is an expression of real floating type. 47 48 Please note that saying that the macros do not raise floating-point 49 exceptions, it is referring to the function that they are performing. It 50 is certainly possible to give them an expression which causes an exception. 51 For example: 52 o+ 53 o NaN < 1.0 54 causes an "invalid" exception, 55 o isless(NaN, 1.0) 56 does not, and 57 o isless(NaN*0., 1.0) 58 causes an exception due to the "NaN*0.", but not from the 59 resultant reduced comparison of isless(NaN, 1.0). 60 o- 61 62 RETURNS 63 @comment Formatting note: "$@" forces a new line 64 No floating-point exceptions are raised for any of the macros.@* 65 The <<isgreater>> macro returns the value of (x) > (y).@* 66 The <<isgreaterequal>> macro returns the value of (x) >= (y).@* 67 The <<isless>> macro returns the value of (x) < (y).@* 68 The <<islessequal>> macro returns the value of (x) <= (y).@* 69 The <<islessgreater>> macro returns the value of (x) < (y) || (x) > (y).@* 70 The <<isunordered>> macro returns 1 if either of its arguments is NaN and 0 otherwise. 71 72 PORTABILITY 73 C99, POSIX. 74 75 */ 76