My friend Nick Poroshin, figure out an interesting way for subj.
for numbers < 32 bits
test num,0
jz l_zero //you may use any of your test for zero
fild dword ptr num //1
fstp qword ptr tempqword
mov eax,tempqword+4
shr eax,20
sub eax,1023

Work with any fpu config.

For number >31 bits

mov eax,num.low
or eax,num.hi
jz l_zero //you may use any of your test for zero
fild qword ptr num //1
fstp qword ptr tempqword
mov eax,tempqword+4
shr eax,20
sub eax,1023
For 53 bit numbers work with any fpu config
for work with 63 bit you need to set round to - internity, or droping (round to zero)
any precision
Posted on 2002-02-04 01:39:32 by The Svin