Determines classifications of floating-point numbers.
IEEE Math Library
(libm.a)
or System V Math Library (libmsaa.a)
#include <math.h> #include <float.h>
int
class( x)
double x;
#include <math.h> #include <float.h>
int
_class( x)
double x;
#include <math.h>
int finite(x) double x;
#include <math.h>
int isnan(x) double x;
#include <math.h>
int unordered(x, y)
double x, y;
The class subroutine, _class subroutine, finite subroutine, isnan subroutine, and unordered subroutine determine the classification of their floating-point value. The unordered subroutine determines if a floating-point comparison involving x and y would generate the IEEE floating-point unordered condition (such as whether x or y is a NaN).
The class subroutine
returns an integer that represents the classification of the floating-point
x parameter. Since class is a reversed
key word in C++. The class subroutine can not be invoked in
a C++ program. The _class subroutine is an interface for C++
program using the class subroutine. The interface and the
return value for class and _class subroutines are identical.
The values returned by the class subroutine are defined in the
float.h header file. The return values are the
following:
Since class is a reserved keyword in C++, the class subroutine cannot be invoked in a C++ program. The _class subroutine is an interface for the C++ program using the class subroutine. The interface and the return values for class and _class subroutines are identical.
The finite subroutine returns a nonzero value if the x parameter is a finite number; that is, if x is not +-, INF, NaNQ, or NaNS.
The isnan subroutine returns a nonzero value if the x parameter is an NaNS or a NaNQ. Otherwise, it returns 0.
The unordered subroutine returns a nonzero value if a floating-point comparison between x and y would be unordered. Otherwise, it returns 0.
Note: Compile any routine that uses subroutines from the libm.a library with the -lm flag. To compile the class.c file, for example, enter:cc class.c -lm
x | Specifies some double-precision floating-point value. |
y | Specifies some double-precision floating-point value. |
The finite, isnan, and unordered subroutines neither return errors nor set bits in the floating-point exception status, even if a parameter is an NaNS.
These subroutines are part of Base Operating System (BOS) Runtime.
List of Numerical Manipulation Services and Subroutines Overview in AIX 5L Version 5.1 General Programming Concepts: Writing and Debugging Programs.