beautypg.com

Motorola DSP96002 User Manual

Page 665

background image

B-146

DSP96002 USER’S MANUAL

MOTOROLA

B.3.2 -x

The arithmetic form signals IOP if x is a signalling NaN. The non-arithmetic form copies x with its sign com-

plemented.

Arithmetic Implementation Of
-d0

Program ICycles

Words

fneg.s d0 ;change sign bit 1 1
--- ---
Totals: 1 1

Non-Arithmetic Implementation Of
-d0

Program ICycles

Words

bchg #31,d0.h ;change sign bit 1 2
--- ---
Totals: 1 2

B.3.3 Scalb(y,N)

Scalb(y,N) returns y*(2**N) for integral values of N without computing 2**N. This is an arithmetic function.

Arithmetic Implementation Of
d0*(2**d1.h)

Program ICycles

Words

fscale.s d1.h,d0 ;scale d0 1 1
--- ---
Totals: 1 1

B.3.4 Logb(x)

Logb(x) returns the unbiased exponent of x, a signed integer in the format of x, except that logb(NaN) is a

NaN, logb(infinite) is +infinity, and logb(0) is -infinity and signals the division by zero exception. When x is

positive and finite, the expression scalb(x,-logb(x)) lies strictly between 0 and 2; it is less than 1 only when

x is denormalized. This is an arithmetic function.

Arithmetic Implementation Of
d0=logb(d1)

Program ICycles

Words

ninf equ $ff800000 ;negative infinity

ftst d1 d1.s,d0.s ;check input, copy 1 1

fjun _done ;done if nan 2 3

fjinf _done ;done if infinity 2 3

fjne _notzero ;jump if non-zero 2 3