Remove scalb(). The scalbn() or scalbln() function should be used.

This commit is contained in:
Ed Schouten 2015-02-12 13:38:13 +01:00
parent c08bd962f2
commit ce4982acf8
6 changed files with 1 additions and 161 deletions

View file

@ -280,10 +280,6 @@ double jn(int, double);
double y0(double);
double y1(double);
double yn(int, double);
#if __XSI_VISIBLE <= 600 || __BSD_VISIBLE
double scalb(double, double);
#endif
#endif /* __BSD_VISIBLE || __XSI_VISIBLE */
#if __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999
@ -392,7 +388,6 @@ float dremf(float, float);
float j0f(float);
float j1f(float);
float jnf(int, float);
float scalbf(float, float);
float y0f(float);
float y1f(float);
float ynf(int, float);

View file

@ -5,7 +5,7 @@ $(CUR_SRCS) = common.c \
e_hypot.c e_hypotf.c e_j0.c e_j0f.c e_j1.c e_j1f.c \
e_jn.c e_jnf.c e_lgamma.c e_lgamma_r.c e_lgammaf.c e_lgammaf_r.c \
e_lgammal.c e_log.c e_log10.c e_log10f.c e_log2.c e_log2f.c e_logf.c \
e_pow.c e_powf.c e_remainder.c e_remainderf.c e_scalb.c e_scalbf.c \
e_pow.c e_powf.c e_remainder.c e_remainderf.c \
e_rem_pio2.c e_rem_pio2f.c \
e_sinh.c e_sinhf.c e_sqrt.c e_sqrtf.c \
k_cos.c k_exp.c k_expf.c k_rem_pio2.c k_sin.c k_tan.c \

View file

@ -1,48 +0,0 @@
/* @(#)e_scalb.c 1.3 95/01/18 */
/*
* ====================================================
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
*
* Developed at SunSoft, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
#include "cdefs-compat.h"
//__FBSDID("$FreeBSD: src/lib/msun/src/e_scalb.c,v 1.13 2008/02/22 02:30:35 das Exp $");
/*
* __ieee754_scalb(x, fn) is provide for
* passing various standard test suite. One
* should use scalbn() instead.
*/
#include <openlibm_math.h>
#include "math_private.h"
#ifdef _SCALB_INT
DLLEXPORT double
__ieee754_scalb(double x, int fn)
#else
DLLEXPORT double
__ieee754_scalb(double x, double fn)
#endif
{
#ifdef _SCALB_INT
return scalbn(x,fn);
#else
if (isnan(x)||isnan(fn)) return x*fn;
if (!isfinite(fn)) {
if(fn>0.0) return x*fn;
else return x/(-fn);
}
if (rint(fn)!=fn) return (fn-fn)/(fn-fn);
if ( fn > 65000.0) return scalbn(x, 65000);
if (-fn > 65000.0) return scalbn(x,-65000);
return scalbn(x,(int)fn);
#endif
}

View file

@ -1,44 +0,0 @@
/* e_scalbf.c -- float version of e_scalb.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.
* ====================================================
*/
#include "cdefs-compat.h"
//__FBSDID("$FreeBSD: src/lib/msun/src/e_scalbf.c,v 1.13 2008/02/22 02:30:35 das Exp $");
#include <openlibm_math.h>
#include "math_private.h"
#ifdef _SCALB_INT
DLLEXPORT float
__ieee754_scalbf(float x, int fn)
#else
DLLEXPORT float
__ieee754_scalbf(float x, float fn)
#endif
{
#ifdef _SCALB_INT
return scalbnf(x,fn);
#else
if (isnan(x)||isnan(fn)) return x*fn;
if (!isfinite(fn)) {
if(fn>(float)0.0) return x*fn;
else return x/(-fn);
}
if (rintf(fn)!=fn) return (fn-fn)/(fn-fn);
if ( fn > (float)65000.0) return scalbnf(x, 65000);
if (-fn > (float)65000.0) return scalbnf(x,-65000);
return scalbnf(x,(int)fn);
#endif
}

View file

@ -291,7 +291,6 @@ irint(double x)
#define __ieee754_jn jn
#define __ieee754_yn yn
#define __ieee754_remainder remainder
#define __ieee754_scalb scalb
#define __ieee754_sqrtf sqrtf
#define __ieee754_acosf acosf
#define __ieee754_acoshf acoshf
@ -316,7 +315,6 @@ irint(double x)
#define __ieee754_jnf jnf
#define __ieee754_ynf ynf
#define __ieee754_remainderf remainderf
#define __ieee754_scalbf scalbf
/* fdlibm kernel function */
int __kernel_rem_pio2(double*,double*,int,int,int);

View file

@ -3807,66 +3807,6 @@ round_test (void)
}
static void
scalb_test (void)
{
init_max_error ();
check_float ("scalb (2.0, 0.5) == NaN plus invalid exception", FUNC(scalb) (2.0, 0.5), nan_value, 0, 0, INVALID_EXCEPTION);
check_float ("scalb (3.0, -2.5) == NaN plus invalid exception", FUNC(scalb) (3.0, -2.5), nan_value, 0, 0, INVALID_EXCEPTION);
check_float ("scalb (0, NaN) == NaN", FUNC(scalb) (0, nan_value), nan_value, 0, 0, 0);
check_float ("scalb (1, NaN) == NaN", FUNC(scalb) (1, nan_value), nan_value, 0, 0, 0);
check_float ("scalb (1, 0) == 1", FUNC(scalb) (1, 0), 1, 0, 0, 0);
check_float ("scalb (-1, 0) == -1", FUNC(scalb) (-1, 0), -1, 0, 0, 0);
check_float ("scalb (0, inf) == NaN plus invalid exception", FUNC(scalb) (0, plus_infty), nan_value, 0, 0, INVALID_EXCEPTION);
check_float ("scalb (-0, inf) == NaN plus invalid exception", FUNC(scalb) (minus_zero, plus_infty), nan_value, 0, 0, INVALID_EXCEPTION);
check_float ("scalb (0, 2) == 0", FUNC(scalb) (0, 2), 0, 0, 0, 0);
check_float ("scalb (-0, -4) == -0", FUNC(scalb) (minus_zero, -4), minus_zero, 0, 0, 0);
check_float ("scalb (0, 0) == 0", FUNC(scalb) (0, 0), 0, 0, 0, 0);
check_float ("scalb (-0, 0) == -0", FUNC(scalb) (minus_zero, 0), minus_zero, 0, 0, 0);
check_float ("scalb (0, -1) == 0", FUNC(scalb) (0, -1), 0, 0, 0, 0);
check_float ("scalb (-0, -10) == -0", FUNC(scalb) (minus_zero, -10), minus_zero, 0, 0, 0);
check_float ("scalb (0, -inf) == 0", FUNC(scalb) (0, minus_infty), 0, 0, 0, 0);
check_float ("scalb (-0, -inf) == -0", FUNC(scalb) (minus_zero, minus_infty), minus_zero, 0, 0, 0);
check_float ("scalb (inf, -1) == inf", FUNC(scalb) (plus_infty, -1), plus_infty, 0, 0, 0);
check_float ("scalb (-inf, -10) == -inf", FUNC(scalb) (minus_infty, -10), minus_infty, 0, 0, 0);
check_float ("scalb (inf, 0) == inf", FUNC(scalb) (plus_infty, 0), plus_infty, 0, 0, 0);
check_float ("scalb (-inf, 0) == -inf", FUNC(scalb) (minus_infty, 0), minus_infty, 0, 0, 0);
check_float ("scalb (inf, 2) == inf", FUNC(scalb) (plus_infty, 2), plus_infty, 0, 0, 0);
check_float ("scalb (-inf, 100) == -inf", FUNC(scalb) (minus_infty, 100), minus_infty, 0, 0, 0);
check_float ("scalb (0.1, -inf) == 0.0", FUNC(scalb) (0.1L, minus_infty), 0.0, 0, 0, 0);
check_float ("scalb (-0.1, -inf) == -0", FUNC(scalb) (-0.1L, minus_infty), minus_zero, 0, 0, 0);
check_float ("scalb (1, inf) == inf", FUNC(scalb) (1, plus_infty), plus_infty, 0, 0, 0);
check_float ("scalb (-1, inf) == -inf", FUNC(scalb) (-1, plus_infty), minus_infty, 0, 0, 0);
check_float ("scalb (inf, inf) == inf", FUNC(scalb) (plus_infty, plus_infty), plus_infty, 0, 0, 0);
check_float ("scalb (-inf, inf) == -inf", FUNC(scalb) (minus_infty, plus_infty), minus_infty, 0, 0, 0);
check_float ("scalb (inf, -inf) == NaN plus invalid exception", FUNC(scalb) (plus_infty, minus_infty), nan_value, 0, 0, INVALID_EXCEPTION);
check_float ("scalb (-inf, -inf) == NaN plus invalid exception", FUNC(scalb) (minus_infty, minus_infty), nan_value, 0, 0, INVALID_EXCEPTION);
check_float ("scalb (NaN, 1) == NaN", FUNC(scalb) (nan_value, 1), nan_value, 0, 0, 0);
check_float ("scalb (1, NaN) == NaN", FUNC(scalb) (1, nan_value), nan_value, 0, 0, 0);
check_float ("scalb (NaN, 0) == NaN", FUNC(scalb) (nan_value, 0), nan_value, 0, 0, 0);
check_float ("scalb (0, NaN) == NaN", FUNC(scalb) (0, nan_value), nan_value, 0, 0, 0);
check_float ("scalb (NaN, inf) == NaN", FUNC(scalb) (nan_value, plus_infty), nan_value, 0, 0, 0);
check_float ("scalb (inf, NaN) == NaN", FUNC(scalb) (plus_infty, nan_value), nan_value, 0, 0, 0);
check_float ("scalb (NaN, NaN) == NaN", FUNC(scalb) (nan_value, nan_value), nan_value, 0, 0, 0);
check_float ("scalb (0.8, 4) == 12.8", FUNC(scalb) (0.8L, 4), 12.8L, 0, 0, 0);
check_float ("scalb (-0.854375, 5) == -27.34", FUNC(scalb) (-0.854375L, 5), -27.34L, 0, 0, 0);
print_max_error ("scalb", 0, 0);
}
static void
scalbn_test (void)
{
@ -4518,7 +4458,6 @@ main (int argc, char **argv)
logb_test ();
modf_test ();
ilogb_test ();
scalb_test ();
scalbn_test ();
scalbln_test ();