1 ! bcc 386 floating point routines (version 2) -- _frexp
2 ! authors: Timothy Murphy (tim@maths.tcd.ie), Bruce Evans
8 ! void frexp(double value, int *exponent);
9 ! splits a double into exponent and fraction (where 0.5 <= fraction < 1.0)
17 mov eax,PC_SIZE+D_LOW[esp] ! lower dword of x
18 mov ebx,PC_SIZE+D_HIGH[esp] ! upper dword of x
19 mov edx,PC_SIZE+D_SIZE[esp] ! exponent pointer
20 mov ecx,ebx ! extract exponent here
24 shr ecx,#D_EXP_SHIFT ! exponent + bias
26 sub ecx,#D_EXP_BIAS-1 ! D_EXP_BIAS is for 1.x form, we want 0.1x form
27 mov [edx],ecx ! return exponent
28 and ebx,#D_SIGN_MASK | D_FRAC_MASK ! extract sign and fraction
29 or ebx,#(D_EXP_BIAS-1) << D_EXP_SHIFT ! set new exponent for 0.1x
40 mov [edx],ecx ! return zero exponent
41 mov ebx,ecx ! guard against -0 (may not be necessary)
53 shld ebx,eax,#D_NORM_BIT+1