Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/powerpc/fpu Fix off-by-one error in exponent when r...



details:   https://anonhg.NetBSD.org/src/rev/d237076a0174
branches:  trunk
changeset: 369819:d237076a0174
user:      rin <rin%NetBSD.org@localhost>
date:      Fri Sep 02 12:24:54 2022 +0000

description:
Fix off-by-one error in exponent when round a double to the
largest normalized value; QNaN was wrongly generated here.

diffstat:

 sys/arch/powerpc/fpu/fpu_implode.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r f5779a8e1464 -r d237076a0174 sys/arch/powerpc/fpu/fpu_implode.c
--- a/sys/arch/powerpc/fpu/fpu_implode.c        Fri Sep 02 12:22:49 2022 +0000
+++ b/sys/arch/powerpc/fpu/fpu_implode.c        Fri Sep 02 12:24:54 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fpu_implode.c,v 1.15 2022/09/02 12:22:49 rin Exp $ */
+/*     $NetBSD: fpu_implode.c,v 1.16 2022/09/02 12:24:54 rin Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -46,7 +46,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fpu_implode.c,v 1.15 2022/09/02 12:22:49 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_implode.c,v 1.16 2022/09/02 12:24:54 rin Exp $");
 
 #include <sys/types.h>
 #include <sys/systm.h>
@@ -502,7 +502,7 @@
                }
                if (fprf)
                        fe->fe_cx |= FPRF_SIGN(sign);
-               return HI_WORD(sign | DBL_EXP(DBL_EXP_INFNAN) | DBL_MASK) |
+               return HI_WORD(sign | DBL_EXP(DBL_EXP_INFNAN - 1) | DBL_MASK) |
                       LO_WORD(~0);
        }
        if (fprf)



Home | Main Index | Thread Index | Old Index