Oracle® Solaris Studio 12.4: Numerical Computation Guide

Exit Print View

Updated: January 2015
 
 

3.4.1 ieee_functions(3m) and ieee_sun(3m)

The functions described by ieee_functions(3m) and ieee_sun(3m) provide capabilities either required by the IEEE standard or recommended in its appendix. These are implemented as efficient bit mask operations.

Table 3-5  ieee_functions(3m)
Function
Description
math.h
Header file
copysign(x,y)
x with y's sign bit
fabs(x)
Absolute value of x
fmod(x, y)
Remainder of x with respect to y
ilogb(x)
Base 2 unbiased exponent of x in integer format
nextafter(x,y)
Next representable number after x, in the direction y
remainder(x,y)
Remainder of x with respect to y
scalbn(x,n)
x × 2n
Table 3-6  ieee_sun(3m)
Function
Description
sunmath.h
Header file
fp_class(x)
Classification function
isinf(x)
Classification function
isnormal(x)
Classification function
issubnormal(x)
Classification function
iszero(x)
Classification function
signbit(x)
Classification function
nonstandard_arithmetic(void)
Enable nonstandard mode
standard_arithmetic(void)
Enable standard mode
ieee_retrospective(*f)
n/a

The remainder(x,y) is the operation specified in IEEE Standard 754-1985. The difference between remainder(x,y) and fmod(x,y) is that the sign of the result returned by remainder(x,y) might not agree with the sign of either x or y, whereas fmod(x,y) always returns a result whose sign agrees with x. Both functions return exact results and do not generate inexact exceptions.

Table 3-7  Calling ieee_functions From Fortran
IEEE Function
Single Precision
Double Precision
Quadruple Precision
copysign(x,y)
t=r_copysign(x,y)
z=d_copysign(x,y)
z=q_copysign(x,y)
ilogb(x)
i=ir_ilogb(x)
i=id_ilogb(x)
i=iq_ilogb(x)
nextafter(x,y)
t=r_nextafter(x,y)
z=d_nextafter(x,y)
z=q_nextafter(x,y)
scalbn(x,n)
t=r_scalbn(x,n)
z=d_scalbn(x,n)
z=q_scalbn(x,n)
signbit(x)
i=ir_signbit(x)
i=id_signbit(x)
i=iq_signbit(x)
Table 3-8  Calling ieee_sun From Fortran
IEEE Function
Single Precision
Double Precision
Quadruple Precision
signbit(x)
i=ir_signbit(x)
i=id_signbit(x)
i=iq_signbit(x)

Note -  You must declare d_function as double precision and q_function as REAL*16 in the Fortran program that uses them.