hi all, how can i realize EXP basic function using floating instructions ? Just another question... to do Y^X ? THX
Posted on 2001-07-06 05:34:00 by angelo
first you need to express x^y as 2^(y * log2(x)), since fpu can only calc 2^val. Then you must seperate 2^val into integer and fractional exponent: 2^int * 2^fraction. Now you can use fscale and f2xm1.
	fld	dword ptr dvY
	fld	dword ptr dvX
	fyl2x

	fld	st(0)
	frndint
	fsub	st(1), st(0)
	fxch	st(1)
	f2xm1
	fld1
	faddp	st(1), st(0)
	fscale
	fstp	dword ptr 
maybe dvX and dvY must be exchanged. beaster. (not self invented, but disassembled from clib :))
Posted on 2001-07-06 10:24:00 by beaster