Add a generic significand implementation

Create a template for significand.

	* math/Makefile (libm-calls): Move s_significandF to...
	(gen-libm-calls): ... here.
	* math/s_significand_template.c: New file.
	* math/s_significand.c: Removed.
	* math/s_significandf.c: Removed.
	* math/s_significandl.c: Removed.
	* sysdeps/ieee754/ldbl-opt/s_significand.c: Removed.
	* sysdeps/ieee754/ldbl-opt/s_significandl.c: Removed.

Signed-off-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
This commit is contained in:
Tulio Magno Quites Machado Filho 2018-06-20 18:15:06 -03:00
parent badba23cac
commit 5e79e0292b
8 changed files with 45 additions and 107 deletions

View File

@ -1,5 +1,14 @@
2018-06-20 Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com> 2018-06-20 Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
* math/Makefile (libm-calls): Move s_significandF to...
(gen-libm-calls): ... here.
* math/s_significand_template.c: New file.
* math/s_significand.c: Removed.
* math/s_significandf.c: Removed.
* math/s_significandl.c: Removed.
* sysdeps/ieee754/ldbl-opt/s_significand.c: Removed.
* sysdeps/ieee754/ldbl-opt/s_significandl.c: Removed.
* math/e_exp2_template.c (declare_mgen_finite_alias, * math/e_exp2_template.c (declare_mgen_finite_alias,
declare_mgen_finite_alias_s, declare_mgen_finite_alias_x): Move to... declare_mgen_finite_alias_s, declare_mgen_finite_alias_x): Move to...
* sysdeps/generic/math-type-macros.h (declare_mgen_finite_alias, * sysdeps/generic/math-type-macros.h (declare_mgen_finite_alias,

View File

@ -53,7 +53,8 @@ gen-libm-calls = cargF conjF cimagF crealF cabsF s_cacosF \
k_casinhF s_csinhF k_casinhF s_csinhF s_catanhF s_catanF \ k_casinhF s_csinhF k_casinhF s_csinhF s_catanhF s_catanF \
s_ctanF s_ctanhF s_cexpF s_clogF s_cprojF s_csqrtF \ s_ctanF s_ctanhF s_cexpF s_clogF s_cprojF s_csqrtF \
s_cpowF s_clog10F s_fdimF s_nextdownF s_fmaxF s_fminF \ s_cpowF s_clog10F s_fdimF s_nextdownF s_fmaxF s_fminF \
s_nanF s_iseqsigF s_canonicalizeF w_ilogbF w_llogbF \ s_nanF s_iseqsigF s_canonicalizeF s_significandF \
w_ilogbF w_llogbF \
w_log1pF w_scalblnF s_fmaxmagF s_fminmagF w_acosF \ w_log1pF w_scalblnF s_fmaxmagF s_fminmagF w_acosF \
w_acoshF w_asinF w_atan2F w_atanhF w_coshF w_exp10F \ w_acoshF w_asinF w_atan2F w_atanhF w_coshF w_exp10F \
w_exp2F w_fmodF w_hypotF w_j0F w_j1F w_jnF w_logF \ w_exp2F w_fmodF w_hypotF w_j0F w_j1F w_jnF w_logF \
@ -69,7 +70,7 @@ libm-calls = \
s_ceilF s_cosF s_erfF s_expm1F s_fabsF \ s_ceilF s_cosF s_erfF s_expm1F s_fabsF \
s_floorF s_log1pF s_logbF \ s_floorF s_log1pF s_logbF \
s_nextafterF s_nexttowardF s_rintF s_scalblnF \ s_nextafterF s_nexttowardF s_rintF s_scalblnF \
s_significandF s_sinF s_tanF s_tanhF \ s_sinF s_tanF s_tanhF \
s_fpclassifyF s_truncF \ s_fpclassifyF s_truncF \
s_remquoF e_log2F s_roundF s_nearbyintF s_sincosF \ s_remquoF e_log2F s_roundF s_nearbyintF s_sincosF \
s_fmaF s_lrintF s_llrintF s_lroundF s_llroundF e_exp10F \ s_fmaF s_lrintF s_llrintF s_lroundF s_llroundF e_exp10F \

View File

@ -1,34 +0,0 @@
/* @(#)s_signif.c 5.1 93/09/24 */
/*
* ====================================================
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
#if defined(LIBM_SCCS) && !defined(lint)
static char rcsid[] = "$NetBSD: s_significand.c,v 1.6 1995/05/10 20:48:11 jtc Exp $";
#endif
/*
* significand(x) computes just
* scalb(x, (double) -ilogb(x)),
* for exercising the fraction-part(F) IEEE 754-1985 test vector.
*/
#include <math.h>
#include <math_private.h>
double __significand(double x)
{
return __ieee754_scalb(x,(double) -__ilogb(x));
}
weak_alias (__significand, significand)
#ifdef NO_LONG_DOUBLE
strong_alias (__significand, __significandl)
weak_alias (__significand, significandl)
#endif

View File

@ -0,0 +1,33 @@
/* Return the mantissa of a floating-point number.
Copyright (C) 2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
/*
* significand(x) computes just
* scalb(x, (FLOAT) - ilogb(x)),
* for exercising the fraction-part(F) IEEE 754-1985 test vector.
*/
#include <math.h>
#include <math_private.h>
FLOAT
M_DECL_FUNC (__significand) (FLOAT x)
{
return M_SUF (__ieee754_scalb) (x,(FLOAT) - M_SUF (__ilogb) (x));
}
declare_mgen_alias (__significand, significand)

View File

@ -1,27 +0,0 @@
/* s_significandf.c -- float version of s_significand.c.
* Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
*/
/*
* ====================================================
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
#if defined(LIBM_SCCS) && !defined(lint)
static char rcsid[] = "$NetBSD: s_significandf.c,v 1.3 1995/05/10 20:48:13 jtc Exp $";
#endif
#include <math.h>
#include <math_private.h>
float __significandf(float x)
{
return __ieee754_scalbf(x,(float) -__ilogbf(x));
}
weak_alias (__significandf, significandf)

View File

@ -1,34 +0,0 @@
/* s_significandl.c -- long double version of s_significand.c.
* Conversion to long double by Ulrich Drepper,
* Cygnus Support, drepper@cygnus.com.
*/
/*
* ====================================================
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
#if defined(LIBM_SCCS) && !defined(lint)
static char rcsid[] = "$NetBSD: $";
#endif
/*
* significandl(x) computes just
* scalbl(x, (long double) -ilogbl(x)),
* for exercising the fraction-part(F) IEEE 754-1985 test vector.
*/
#include <math.h>
#include <math_private.h>
long double __significandl(long double x)
{
return __ieee754_scalbl(x,(long double) -__ilogbl(x));
}
weak_alias (__significandl, significandl)

View File

@ -1,5 +0,0 @@
#include <math_ldbl_opt.h>
#include <math/s_significand.c>
#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
compat_symbol (libm, __significand, significandl, GLIBC_2_0);
#endif

View File

@ -1,5 +0,0 @@
#include <math_ldbl_opt.h>
#undef weak_alias
#define weak_alias(n,a)
#include <math/s_significandl.c>
long_double_symbol (libm, __significandl, significandl);