/* This C language subroutine seperates the mantissa of a floating point number from its exponent. The Run Time Library for the C Language. Gordon A. Sterling (617) 461 - 3076 DSP Development Tools Engineering Created on 04/25/90 Updated on 5/94 by AS Updated on 1/95 by AS - separated polymorphic functions #include
float frexpf(float x, int *exp); */ #include "lib_glob.h" #include "mth_glob.h" .SEGMENT/CODE Code_Space_Name; .FILE RTL_FILENAME; .GLOBAL ___frexpfP; ___frexpfP: pm_lnt=0; frexp_core: R2=LOGB F4, R1=dm_0; /*Get 2*mantissa*/ IF AV R2=R1-1; /*Handle 0 correctly*/ R2=R2+1, pm_ptr=R8; /*Increment exponent*/ R2=-R2, R1=R2; /*Invert exponent set *exp*/ F0=SCALB F4 BY R2, PM(pm_ptr,0)=R1; /*Move mantissa in [.5,1)*/ pm_write: FETCH_RETURN restore_state: RETURN (DB); RESTORE_STACK RESTORE_FRAME .ENDSEG;