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 For the extended precision, the MSB of the...
details: https://anonhg.NetBSD.org/src/rev/6cd8115ef03b
branches: trunk
changeset: 335984:6cd8115ef03b
user: isaki <isaki%NetBSD.org@localhost>
date: Thu Feb 05 12:23:27 2015 +0000
description:
For the extended precision, the MSB of the mantissa is an integer
part, and this bit must be ignored at Infinity.
found by tests/lib/libc/stdlib/t_strtod.c::strtold_inf.
diffstat:
sys/arch/m68k/fpe/fpu_explode.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diffs (49 lines):
diff -r 1ed82a1da4b7 -r 6cd8115ef03b sys/arch/m68k/fpe/fpu_explode.c
--- a/sys/arch/m68k/fpe/fpu_explode.c Thu Feb 05 12:22:06 2015 +0000
+++ b/sys/arch/m68k/fpe/fpu_explode.c Thu Feb 05 12:23:27 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fpu_explode.c,v 1.14 2013/03/26 11:30:20 isaki Exp $ */
+/* $NetBSD: fpu_explode.c,v 1.15 2015/02/05 12:23:27 isaki Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -46,7 +46,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fpu_explode.c,v 1.14 2013/03/26 11:30:20 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_explode.c,v 1.15 2015/02/05 12:23:27 isaki Exp $");
#include <sys/types.h>
#include <sys/systm.h>
@@ -183,18 +183,17 @@
fpu_xtof(struct fpn *fp, uint32_t i, uint32_t j, uint32_t k)
{
int exp;
- uint32_t frac, f0, f1, f2;
+ uint32_t f0, f1, f2;
#define EXT_SHIFT (EXT_FRACBITS - 1 - 32 - FP_LG)
exp = (i >> (32 - 1 - EXT_EXPBITS)) & mask(EXT_EXPBITS);
f0 = j >> EXT_SHIFT;
f1 = (j << (32 - EXT_SHIFT)) | (k >> EXT_SHIFT);
f2 = k << (32 - EXT_SHIFT);
- frac = j | k;
/* m68k extended does not imply denormal by exp==0 */
if (exp == 0) {
- if (frac == 0)
+ if ((j | k) == 0)
return (FPC_ZERO);
fp->fp_exp = - EXT_EXP_BIAS;
fp->fp_mant[0] = f0;
@@ -204,7 +203,8 @@
return (FPC_NUM);
}
if (exp == (2 * EXT_EXP_BIAS + 1)) {
- if (frac == 0)
+ /* MSB is an integer part and don't care */
+ if ((j & 0x7fffffff) == 0 && k == 0)
return (FPC_INF);
fp->fp_mant[0] = f0;
fp->fp_mant[1] = f1;
Home |
Main Index |
Thread Index |
Old Index