CRE Programmer's Guide

Math Functions
Common Run-Time Environment (CRE) Programmer’s Guide528146-004
7-22
Truncate
Return Value
The Tanh functions return the hyperbolic tangent of number. The value returned is:
tanh = sinh( number )
cosh( number ))
Considerations
An arithmetic fault occurs if an intermediate calculation causes an overflow.
Truncate
The Truncate functions return the nonfractional part of a number. These functions are
not available in the native CRE library.
number
is the number whose integral part is returned.
Return Value
The Truncate functions return the number whose absolute value is the largest integer
that does not exceed the absolute value of
number and has the same sign as number.
The Truncate functions return:
ceil(
number) if number < 0
modf(
number) if number is greater than or equal to 0
Example
REAL(32) r;
r := RTL_Truncate_Real32_(1.6E0); ! r gets 1
r := RTL_Truncate_Real32_(-2.7E0); ! r gets -2
Upper
The Upper function returns the smallest integer that is not less than number.
REAL(32) PROC RTL_Truncate_Real32_( number );
REAL(32) number; ! in TNS only
REAL(64) PROC RTL_Truncate_Real64_( number );
REAL(64) number; ! in TNS only
REAL(64) PROC RTL_Upper_Real64_( number );
REAL(64) number; ! in TNS only