HP-UX Floating-Point Guide
116 Chapter 4
HP-UX Math Libraries on HP 9000 Systems
Contents of the HP-UX Math Libraries
promote the argument to double, and the function call either generates
a linker error or produces incorrect results. To compile in ANSI mode,
use a command line like the following:
cc program_name.c -lm
aCC program_name.C -lm
Degree-Valued Trigonometric Functions
The Fortran math library defines a set of trigonometric functions whose
arguments or results are specified in degrees rather than radians. These
functions are also implemented in libm. The names of these functions
are the same as the names of the standard versions but with the letter d
appended: sind, cosd, and so on. (For float versions of degree-valued
trigonometric functions, the f follows the d.)
To use the double-precision versions of these functions, compile your
program in any mode except strict ANSI mode (-Aa). Use either
extended ANSI mode (-Ae, the default), non-ANSI mode (-Ac), or -Aa
-D_HPUX_SOURCE. To use the float versions, compile in extended ANSI
mode (-Ae). “float Type Math Functions” on page 115.
Floating-Point Classification Macro
The fpclassify macro is the HP version of the class function
recommended by the IEEE standard. The ANSI/ISO C committee has
also included this macro in the C9X standard. The fpclassify macro
accepts either a double or a float argument. It returns an integer
value that describes the class of the argument—that is, what kind of
floating-point value it is. Table 4-1 shows the values and their meanings,
which are defined in math.h.
Table 4-1 fpclassify Values
Class Name of Macro
Normalized FP_NORMAL
Zero FP_ZERO
Infinity FP_INFINITE
Denormalized FP_SUBNORMAL
NaN FP_NAN