Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/m68k/fpe Fix fpu_ftox().



details:   https://anonhg.NetBSD.org/src/rev/57ba023f36bd
branches:  trunk
changeset: 785601:57ba023f36bd
user:      isaki <isaki%NetBSD.org@localhost>
date:      Fri Mar 22 13:46:38 2013 +0000

description:
Fix fpu_ftox().
Update not only exponential but also mantissa when an integer part
becomes 2 by rounding up.  Without this fix, the extended precision
value becomes 0.0 because mantissa (including explicit integer bit)
is all-zero.

diffstat:

 sys/arch/m68k/fpe/fpu_implode.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (30 lines):

diff -r bf489e963b57 -r 57ba023f36bd sys/arch/m68k/fpe/fpu_implode.c
--- a/sys/arch/m68k/fpe/fpu_implode.c   Fri Mar 22 13:28:11 2013 +0000
+++ b/sys/arch/m68k/fpe/fpu_implode.c   Fri Mar 22 13:46:38 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fpu_implode.c,v 1.13 2013/03/19 09:17:17 isaki Exp $ */
+/*     $NetBSD: fpu_implode.c,v 1.14 2013/03/22 13:46:38 isaki Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -46,7 +46,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fpu_implode.c,v 1.13 2013/03/19 09:17:17 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_implode.c,v 1.14 2013/03/22 13:46:38 isaki Exp $");
 
 #include <sys/types.h>
 #include <sys/systm.h>
@@ -433,8 +433,10 @@
 #if (FP_NMANT - FP_NG - EXT_FRACBITS) > 0
        (void) fpu_shr(fp, FP_NMANT - FP_NG - EXT_FRACBITS);
 #endif
-       if (fpu_round(fe, fp) && fp->fp_mant[0] == EXT_EXPLICIT2)
+       if (fpu_round(fe, fp) && fp->fp_mant[0] == EXT_EXPLICIT2) {
                exp++;
+               fpu_shr(fp, 1);
+       }
        if (exp >= EXT_EXP_INFNAN) {
                fe->fe_fpsr |= FPSR_OPERR | FPSR_INEX2 | FPSR_OVFL;
                if (toinf(fe, sign)) {



Home | Main Index | Thread Index | Old Index