I wrote these float procedures and I found out that
they create problems:
My program is unpredictable and comp reboots.
Only after hours of debugging I conclude these functions
are the problem.
So what do I do to make them usable?
Thanks.
double mylog2(double nb){
double rez,y=1;
_asm{
fld [y]
fld [nb]
fyl2x
fstp [rez]
}
return rez;
}
double myexp2(double nb){
double rez,rez2,y=1,nbi,nbf;
short fcv,fcb;
_asm{
fstcw fcv
mov ax,fcv
mov fcb,ax
or fcv,0xC00
//------------
fld [nb]
fldcw fcv
frndint
fldcw fcb
fstp [nbi]
}
nbf=nb-nbi;
_asm{
fld [nbf]
f2xm1
fstp [rez2]
//-------------
fld [nbi]
fld [y]
fscale
fstp [rez]
}
rez*=(rez2+1);
return (rez);
}