;;345678901234567890123456789012345678901234567890123456789012345678901234567890 ;;********** ;;* logexp2.asm: base-2 logarithm and exponent ;;* Copyright 2003 Duane K. Wise ;;********** org l: log2Tab dc -1023087329808,5577163454524,-17541124758042 dc 43328084931985,-78540235168623,103513368583182 dc -98107481863207,65200444954112,-28861715242043 dc 7647611088685,-918150744020 exp2Tab dc 70368744355749,48775879188841,16904715390224 dc 3904102273128,681464029041,87196245988,15386678159 dreg0 ds 1 dreg1 ds 1 dreg2 ds 1 org p: ;;********** ;;* Function: log2 - base-2 logarithm, double-precision ;;* Input: a - signed 9.47 linear value (overflow bits are significant) ;;* Output: a - signed 7.41 base-2 logarithm of input ;;* Consumed: b,x,y,r5 ;;* Notes: assumed m5 is set to -1 ;;* the log of zero or less is returned as -48.0, ;;* else there is about 36 bits of accuracy in the result (7.29) ;;* it is OK to round the result to single-precision ;;********** log2: tst a ble -8,x0 cmp x0,b tle x0,b normf b1,a rts