CRE Programmer's Guide

Math Functions
Common Run-Time Environment (CRE) Programmer’s Guide528146-004
7-12
Normalize
Example
INT i, j, k;
REAL(32) r, s, t;
i := 17;
j := 5;
k := RTL_Mod_Int16_(i, j); ! k gets 2
r := 17.2E0;
s := 0.5E0;
t := RTL_Mod_Real32_(r, s); ! t gets 0.2E0
Normalize
The Normalize function splits a floating-point number into a normalized fraction and an
integer power of two. This function is not available in the native CRE library.
number
is the number to split.
power
is a reference parameter into which Normalize stores the integer power of 2.
Return Value
Normalize returns a number, y, such that:
0.5 is less than or equal to y < 1 and
number = y * 2
power
If number = 0, Normalize returns 0 for both power and the return value.
Example
INT i;
REAL(64) r, s;
r := 1.5L0;
s := RTL_Normalize_Real64_(r, i); ! s gets 0.75L0
! i gets 1
REAL(64) PROC RTL_Normalize_Real64_( number, power );
REAL(64) number; ! in
INT .EXT power; ! out TNS only