Make ext_fraclm and ext_frachm parts of the long double mantissa optional

in generic code
This commit is contained in:
martin 2013-11-21 14:14:13 +00:00
parent 48489d0202
commit 60fdeb717f
3 changed files with 38 additions and 14 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: fpclassifyl_ieee754.c,v 1.1 2011/01/17 23:53:03 matt Exp $ */
/* $NetBSD: fpclassifyl_ieee754.c,v 1.2 2013/11/21 14:14:13 martin Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: fpclassifyl_ieee754.c,v 1.1 2011/01/17 23:53:03 matt Exp $");
__RCSID("$NetBSD: fpclassifyl_ieee754.c,v 1.2 2013/11/21 14:14:13 martin Exp $");
#endif
#include <machine/ieee.h>
@ -50,14 +50,26 @@ __fpclassifyl(long double x)
u.extu_ld = x;
if (u.extu_ext.ext_exp == 0) {
if (u.extu_ext.ext_frach == 0 && u.extu_ext.ext_frachm == 0
&& u.extu_ext.ext_fraclm == 0 && u.extu_ext.ext_fracl == 0)
if (u.extu_ext.ext_frach == 0
#if EXT_FRACHMBITS
&& u.extu_ext.ext_frachm == 0
#endif
#if EXT_FRACLMBITS
&& u.extu_ext.ext_fraclm == 0
#endif
&& u.extu_ext.ext_fracl == 0)
return FP_ZERO;
else
return FP_SUBNORMAL;
} else if (u.extu_ext.ext_exp == EXT_EXP_INFNAN) {
if (u.extu_ext.ext_frach == 0 && u.extu_ext.ext_frachm == 0
&& u.extu_ext.ext_fraclm == 0 && u.extu_ext.ext_fracl == 0)
if (u.extu_ext.ext_frach == 0
#f EXT_FRACHMBITS
&& u.extu_ext.ext_frachm == 0
#endif
#if EXT_FRACLMBITS
&& u.extu_ext.ext_fraclm == 0
#endif
&& u.extu_ext.ext_fracl == 0)
return FP_INFINITE;
else
return FP_NAN;

View File

@ -1,4 +1,4 @@
/* $NetBSD: isinfl_ieee754.c,v 1.4 2011/01/17 23:53:03 matt Exp $ */
/* $NetBSD: isinfl_ieee754.c,v 1.5 2013/11/21 14:14:13 martin Exp $ */
/*
* Copyright (c) 1992, 1993
@ -40,7 +40,7 @@
#if 0
static char sccsid[] = "@(#)isinf.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: isinfl_ieee754.c,v 1.4 2011/01/17 23:53:03 matt Exp $");
__RCSID("$NetBSD: isinfl_ieee754.c,v 1.5 2013/11/21 14:14:13 martin Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -60,7 +60,13 @@ __isinfl(long double x)
u.extu_ld = x;
return u.extu_ext.ext_exp == EXT_EXP_INFNAN
&& u.extu_ext.ext_frach == 0 && u.extu_ext.ext_frachm == 0
&& u.extu_ext.ext_fraclm == 0 && u.extu_ext.ext_fracl == 0;
&& u.extu_ext.ext_frach == 0
#if EXT_FRACHMBITS
&& u.extu_ext.ext_frachm == 0
#endif
#if EXT_FRACLMBITS
&& u.extu_ext.ext_fraclm == 0
#endif
&& u.extu_ext.ext_fracl == 0;
}
#endif /* __HAVE_LONG_DOUBLE */

View File

@ -1,4 +1,4 @@
/* $NetBSD: isnanl_ieee754.c,v 1.6 2011/01/17 23:53:03 matt Exp $ */
/* $NetBSD: isnanl_ieee754.c,v 1.7 2013/11/21 14:14:13 martin Exp $ */
/*
* Copyright (c) 1992, 1993
@ -40,7 +40,7 @@
#if 0
static char sccsid[] = "@(#)isinf.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: isnanl_ieee754.c,v 1.6 2011/01/17 23:53:03 matt Exp $");
__RCSID("$NetBSD: isnanl_ieee754.c,v 1.7 2013/11/21 14:14:13 martin Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -60,7 +60,13 @@ __isnanl(long double x)
u.extu_ld = x;
return u.extu_ext.ext_exp == EXT_EXP_INFNAN
&& (u.extu_ext.ext_frach != 0 || u.extu_ext.ext_frachm != 0
|| u.extu_ext.ext_fraclm != 0 || u.extu_ext.ext_fracl != 0);
&& (u.extu_ext.ext_frach != 0
#if EXT_FRACHMBITS
|| u.extu_ext.ext_frachm != 0
#endif
#if EXT_FRACLMBITS
|| u.extu_ext.ext_fraclm != 0
#endif
|| u.extu_ext.ext_fracl != 0);
}
#endif /* __HAVE_LONG_DOUBLE */