Permalink
Browse files

Fixed some floating point errors due to lack of precision when trunca…

…ting from

80-bit to 64-bit. Instead of truncating, this will round up if
appropriate.
  • Loading branch information...
1 parent 46b3740 commit d76f63bec2f06f87457cf2868f24ceb6a948ff65 @jnicholl jnicholl committed Mar 21, 2013
Showing with 3 additions and 0 deletions.
  1. +3 −0 src/fpu/fpu_instructions.h
@@ -103,6 +103,9 @@ static Real64 FPU_FLD80(PhysPt addr) {
Bit64s exp64final = ((exp64 >0)?blah:-blah) +BIAS64;
Bit64s mant64 = (test.eind.ll >> 11) & LONGTYPE(0xfffffffffffff);
+ if ((test.eind.ll & 0x7ff) > 0x400) {
+ mant64 += 1;
+ }
Bit64s sign = (test.begin&0x8000)?1:0;
FPU_Reg result;
result.ll = (sign <<63)|(exp64final << 52)| mant64;

0 comments on commit d76f63b

Please sign in to comment.