- Fixed arithmetic semantics. Making it more Windows compatible.

- This example work now.
double F2F(PFLOATOBJ f)
{
 if(SIGN(f->ul1)) // negate mant
   return (double) -(-f->ul1 * pow(2,(double)f->ul2-32));
 else return (double) f->ul1 * pow(2,(double)f->ul2-32);
}

svn path=/trunk/; revision=26877
This commit is contained in:
James Tabor 2007-05-24 01:39:31 +00:00
parent 8b7099f2cd
commit 9f2630ccce
2 changed files with 18 additions and 14 deletions

View file

@ -31,8 +31,9 @@ EFtoF( EFLOAT_S * efp)
Sign = SIGN(Mant);
//// M$ storage emulation
if( Sign ) Mant = -Mant;
Mant = ((Mant & 0x3fffffff) >> 7);
Exp += (1 - EXCESS);
Exp += (EXCESS-1);
////
Mant = MANT(Mant);
return PACK(Sign, Exp, Mant);
@ -42,7 +43,7 @@ VOID
FASTCALL
FtoEF( EFLOAT_S * efp, FLOATL f)
{
long Mant, Exp;
long Mant, Exp, Sign = 0;
gxf_long worker;
#ifdef _X86_
@ -53,10 +54,12 @@ FtoEF( EFLOAT_S * efp, FLOATL f)
Exp = EXP(worker.l);
Mant = MANT(worker.l);
if (SIGN(worker.l)) Sign = -1;
//// M$ storage emulation
Mant = ((Mant << 7) | 0x40000000 | SIGN(worker.l));
Exp -= (1 - EXCESS);
Mant = ((Mant << 7) | 0x40000000);
Mant ^= Sign;
Mant -= Sign;
Exp -= (EXCESS-1);
////
efp->lMant = Mant;
efp->lExp = Exp;

View file

@ -101,9 +101,7 @@ VOID
FASTCALL
EF_Negate(EFLOAT_S * efp)
{
// Do it this way since ReactOS uses real FP.
if (SIGN(efp->lMant)) efp->lMant = efp->lMant & ~SIGNBIT;
else efp->lMant = efp->lMant | SIGNBIT;
efp->lMant = -efp->lMant;
}
LONG
@ -119,8 +117,9 @@ EFtoF( EFLOAT_S * efp)
Sign = SIGN(Mant);
//// M$ storage emulation
if( Sign ) Mant = -Mant;
Mant = ((Mant & 0x3fffffff) >> 7);
Exp += (1 - EXCESS);
Exp += (EXCESS-1);
////
Mant = MANT(Mant);
return PACK(Sign, Exp, Mant);
@ -130,7 +129,7 @@ VOID
FASTCALL
FtoEF( EFLOAT_S * efp, FLOATL f)
{
long Mant, Exp;
long Mant, Exp, Sign = 0;
gxf_long worker;
#ifdef _X86_
@ -141,10 +140,12 @@ FtoEF( EFLOAT_S * efp, FLOATL f)
Exp = EXP(worker.l);
Mant = MANT(worker.l);
if (SIGN(worker.l)) Sign = -1;
//// M$ storage emulation
Mant = ((Mant << 7) | 0x40000000 | SIGN(worker.l));
Exp -= (1 - EXCESS);
Mant = ((Mant << 7) | 0x40000000);
Mant ^= Sign;
Mant -= Sign;
Exp -= (EXCESS-1);
////
efp->lMant = Mant;
efp->lExp = Exp;