mirror of git://sourceware.org/git/glibc.git
Remove unused ldbl-96 functions (bug 15004).
This commit is contained in:
parent
91a1f3fea0
commit
8bca7cd830
18
ChangeLog
18
ChangeLog
|
@ -1,5 +1,23 @@
|
||||||
2013-11-28 Joseph Myers <joseph@codesourcery.com>
|
2013-11-28 Joseph Myers <joseph@codesourcery.com>
|
||||||
|
|
||||||
|
[BZ #15004]
|
||||||
|
* sysdeps/ieee754/ldbl-96/e_atan2l.c: Remove file.
|
||||||
|
* sysdeps/ieee754/ldbl-96/e_ilogbl.c: Likewise.
|
||||||
|
* sysdeps/ieee754/ldbl-96/e_remainderl.c: Likewise.
|
||||||
|
* sysdeps/ieee754/ldbl-96/s_ceill.c: Likewise.
|
||||||
|
* sysdeps/ieee754/ldbl-96/s_fabsl.c: Likewise.
|
||||||
|
* sysdeps/ieee754/ldbl-96/s_finitel.c: Likewise.
|
||||||
|
* sysdeps/ieee754/ldbl-96/s_floorl.c: Likewise.
|
||||||
|
* sysdeps/ieee754/ldbl-96/s_fpclassifyl.c: Likewise.
|
||||||
|
* sysdeps/ieee754/ldbl-96/s_isinfl.c: Likewise.
|
||||||
|
* sysdeps/ieee754/ldbl-96/s_isnanl.c: Likewise.
|
||||||
|
* sysdeps/ieee754/ldbl-96/s_logbl.c: Likewise.
|
||||||
|
* sysdeps/ieee754/ldbl-96/s_nearbyintl.c: Likewise.
|
||||||
|
* sysdeps/ieee754/ldbl-96/s_nextafterl.c: Likewise.
|
||||||
|
* sysdeps/ieee754/ldbl-96/s_rintl.c: Likewise.
|
||||||
|
* sysdeps/ieee754/ldbl-96/s_scalbnl.c: Likewise.
|
||||||
|
* sysdeps/ieee754/ldbl-96/s_truncl.c: Likewise.
|
||||||
|
|
||||||
* sysdeps/powerpc/nofpu/atomic-feclearexcept.c: New file.
|
* sysdeps/powerpc/nofpu/atomic-feclearexcept.c: New file.
|
||||||
* sysdeps/powerpc/nofpu/atomic-feholdexcept.c: Likewise.
|
* sysdeps/powerpc/nofpu/atomic-feholdexcept.c: Likewise.
|
||||||
* sysdeps/powerpc/nofpu/atomic-feupdateenv.c: Likewise.
|
* sysdeps/powerpc/nofpu/atomic-feupdateenv.c: Likewise.
|
||||||
|
|
18
NEWS
18
NEWS
|
@ -11,15 +11,15 @@ Version 2.19
|
||||||
|
|
||||||
156, 387, 431, 832, 2801, 7003, 9954, 10253, 10278, 11087, 11157, 11214,
|
156, 387, 431, 832, 2801, 7003, 9954, 10253, 10278, 11087, 11157, 11214,
|
||||||
13028, 13982, 13985, 14029, 14143, 14155, 14547, 14699, 14752, 14876,
|
13028, 13982, 13985, 14029, 14143, 14155, 14547, 14699, 14752, 14876,
|
||||||
14910, 15048, 15218, 15277, 15308, 15362, 15374, 15400, 15427, 15483,
|
14910, 15004, 15048, 15218, 15277, 15308, 15362, 15374, 15400, 15427,
|
||||||
15522, 15531, 15532, 15601, 15608, 15609, 15610, 15632, 15640, 15670,
|
15483, 15522, 15531, 15532, 15601, 15608, 15609, 15610, 15632, 15640,
|
||||||
15672, 15680, 15681, 15723, 15734, 15735, 15736, 15748, 15749, 15754,
|
15670, 15672, 15680, 15681, 15723, 15734, 15735, 15736, 15748, 15749,
|
||||||
15760, 15763, 15764, 15797, 15799, 15825, 15844, 15847, 15849, 15855,
|
15754, 15760, 15763, 15764, 15797, 15799, 15825, 15844, 15847, 15849,
|
||||||
15856, 15857, 15859, 15867, 15886, 15887, 15890, 15892, 15893, 15895,
|
15855, 15856, 15857, 15859, 15867, 15886, 15887, 15890, 15892, 15893,
|
||||||
15897, 15905, 15909, 15917, 15919, 15921, 15923, 15939, 15948, 15963,
|
15895, 15897, 15905, 15909, 15917, 15919, 15921, 15923, 15939, 15948,
|
||||||
15966, 15985, 15988, 15997, 16032, 16034, 16036, 16037, 16041, 16055,
|
15963, 15966, 15985, 15988, 15997, 16032, 16034, 16036, 16037, 16041,
|
||||||
16071, 16072, 16074, 16077, 16078, 16103, 16112, 16143, 16144, 16146,
|
16055, 16071, 16072, 16074, 16077, 16078, 16103, 16112, 16143, 16144,
|
||||||
16150, 16151, 16153, 16167, 16172, 16245, 16271.
|
16146, 16150, 16151, 16153, 16167, 16172, 16245, 16271.
|
||||||
|
|
||||||
* The public headers no longer use __unused nor __block. This change is to
|
* The public headers no longer use __unused nor __block. This change is to
|
||||||
support compiling programs that are derived from BSD sources and use
|
support compiling programs that are derived from BSD sources and use
|
||||||
|
|
|
@ -1,125 +0,0 @@
|
||||||
/* e_atan2l.c -- long double version of e_atan2.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.
|
|
||||||
* ====================================================
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* __ieee754_atan2l(y,x)
|
|
||||||
* Method :
|
|
||||||
* 1. Reduce y to positive by atan2(y,x)=-atan2(-y,x).
|
|
||||||
* 2. Reduce x to positive by (if x and y are unexceptional):
|
|
||||||
* ARG (x+iy) = arctan(y/x) ... if x > 0,
|
|
||||||
* ARG (x+iy) = pi - arctan[y/(-x)] ... if x < 0,
|
|
||||||
*
|
|
||||||
* Special cases:
|
|
||||||
*
|
|
||||||
* ATAN2((anything), NaN ) is NaN;
|
|
||||||
* ATAN2(NAN , (anything) ) is NaN;
|
|
||||||
* ATAN2(+-0, +(anything but NaN)) is +-0 ;
|
|
||||||
* ATAN2(+-0, -(anything but NaN)) is +-pi ;
|
|
||||||
* ATAN2(+-(anything but 0 and NaN), 0) is +-pi/2;
|
|
||||||
* ATAN2(+-(anything but INF and NaN), +INF) is +-0 ;
|
|
||||||
* ATAN2(+-(anything but INF and NaN), -INF) is +-pi;
|
|
||||||
* ATAN2(+-INF,+INF ) is +-pi/4 ;
|
|
||||||
* ATAN2(+-INF,-INF ) is +-3pi/4;
|
|
||||||
* ATAN2(+-INF, (anything but,0,NaN, and INF)) is +-pi/2;
|
|
||||||
*
|
|
||||||
* Constants:
|
|
||||||
* The hexadecimal values are the intended ones for the following
|
|
||||||
* constants. The decimal values may be used, provided that the
|
|
||||||
* compiler will convert from decimal to binary accurately enough
|
|
||||||
* to produce the hexadecimal values shown.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
#include <math_private.h>
|
|
||||||
|
|
||||||
static const long double
|
|
||||||
tiny = 1.0e-4900L,
|
|
||||||
zero = 0.0,
|
|
||||||
pi_o_4 = 7.85398163397448309628202E-01L, /* 0x3FFE, 0xC90FDAA2, 0x2168C235 */
|
|
||||||
pi_o_2 = 1.5707963267948966192564E+00L, /* 0x3FFF, 0xC90FDAA2, 0x2168C235 */
|
|
||||||
pi = 3.14159265358979323851281E+00L, /* 0x4000, 0xC90FDAA2, 0x2168C235 */
|
|
||||||
pi_lo = -5.01655761266833202345176e-20L;/* 0xBFBE, 0xECE675D1, 0xFC8F8CBB */
|
|
||||||
|
|
||||||
long double
|
|
||||||
__ieee754_atan2l (long double y, long double x)
|
|
||||||
{
|
|
||||||
long double z;
|
|
||||||
int32_t k,m,hx,hy,ix,iy;
|
|
||||||
u_int32_t sx,sy,lx,ly;
|
|
||||||
|
|
||||||
GET_LDOUBLE_WORDS(sx,hx,lx,x);
|
|
||||||
ix = sx&0x7fff;
|
|
||||||
lx |= hx & 0x7fffffff;
|
|
||||||
GET_LDOUBLE_WORDS(sy,hy,ly,y);
|
|
||||||
iy = sy&0x7fff;
|
|
||||||
ly |= hy & 0x7fffffff;
|
|
||||||
if(((2*ix|((lx|-lx)>>31))>0xfffe)||
|
|
||||||
((2*iy|((ly|-ly)>>31))>0xfffe)) /* x or y is NaN */
|
|
||||||
return x+y;
|
|
||||||
if(((sx-0x3fff)|lx)==0) return __atanl(y); /* x=1.0 */
|
|
||||||
m = ((sy>>15)&1)|((sx>>14)&2); /* 2*sign(x)+sign(y) */
|
|
||||||
|
|
||||||
/* when y = 0 */
|
|
||||||
if((iy|ly)==0) {
|
|
||||||
switch(m) {
|
|
||||||
case 0:
|
|
||||||
case 1: return y; /* atan(+-0,+anything)=+-0 */
|
|
||||||
case 2: return pi+tiny;/* atan(+0,-anything) = pi */
|
|
||||||
case 3: return -pi-tiny;/* atan(-0,-anything) =-pi */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* when x = 0 */
|
|
||||||
if((ix|lx)==0) return (sy>=0x8000)? -pi_o_2-tiny: pi_o_2+tiny;
|
|
||||||
|
|
||||||
/* when x is INF */
|
|
||||||
if(ix==0x7fff) {
|
|
||||||
if(iy==0x7fff) {
|
|
||||||
switch(m) {
|
|
||||||
case 0: return pi_o_4+tiny;/* atan(+INF,+INF) */
|
|
||||||
case 1: return -pi_o_4-tiny;/* atan(-INF,+INF) */
|
|
||||||
case 2: return 3.0*pi_o_4+tiny;/*atan(+INF,-INF)*/
|
|
||||||
case 3: return -3.0*pi_o_4-tiny;/*atan(-INF,-INF)*/
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
switch(m) {
|
|
||||||
case 0: return zero ; /* atan(+...,+INF) */
|
|
||||||
case 1: return -zero ; /* atan(-...,+INF) */
|
|
||||||
case 2: return pi+tiny ; /* atan(+...,-INF) */
|
|
||||||
case 3: return -pi-tiny ; /* atan(-...,-INF) */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* when y is INF */
|
|
||||||
if(iy==0x7fff) return (sy>=0x8000)? -pi_o_2-tiny: pi_o_2+tiny;
|
|
||||||
|
|
||||||
/* compute y/x */
|
|
||||||
k = sy-sx;
|
|
||||||
if(k > 70) z=pi_o_2+0.5*pi_lo; /* |y/x| > 2**70 */
|
|
||||||
else if(sx>=0x8000&&k<-70) z=0.0; /* |y|/x < -2**70 */
|
|
||||||
else z=__atanl(fabsl(y/x)); /* safe to do y/x */
|
|
||||||
switch (m) {
|
|
||||||
case 0: return z ; /* atan(+,+) */
|
|
||||||
case 1: {
|
|
||||||
u_int32_t sz;
|
|
||||||
GET_LDOUBLE_EXP(sz,z);
|
|
||||||
SET_LDOUBLE_EXP(z,sz ^ 0x8000);
|
|
||||||
}
|
|
||||||
return z ; /* atan(-,+) */
|
|
||||||
case 2: return pi-(z-pi_lo);/* atan(+,-) */
|
|
||||||
default: /* case 3 */
|
|
||||||
return (z-pi_lo)-pi;/* atan(-,-) */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
strong_alias (__ieee754_atan2l, __atan2l_finite)
|
|
|
@ -1,59 +0,0 @@
|
||||||
/* s_ilogbl.c -- long double version of s_ilogb.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
|
|
||||||
|
|
||||||
/* ilogbl(long double x)
|
|
||||||
* return the binary exponent of non-zero x
|
|
||||||
* ilogbl(0) = FP_ILOGB0
|
|
||||||
* ilogbl(NaN) = FP_ILOGBNAN (no signal is raised)
|
|
||||||
* ilogbl(+-Inf) = INT_MAX (no signal is raised)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <limits.h>
|
|
||||||
#include <math.h>
|
|
||||||
#include <math_private.h>
|
|
||||||
|
|
||||||
int __ieee754_ilogbl (long double x)
|
|
||||||
{
|
|
||||||
int32_t es,hx,lx,ix;
|
|
||||||
|
|
||||||
GET_LDOUBLE_EXP(es,x);
|
|
||||||
es &= 0x7fff;
|
|
||||||
if(es==0) {
|
|
||||||
GET_LDOUBLE_WORDS(es,hx,lx,x);
|
|
||||||
if((hx|lx)==0)
|
|
||||||
return FP_ILOGB0; /* ilogbl(0) = FP_ILOGB0 */
|
|
||||||
else /* subnormal x */
|
|
||||||
if(hx==0) {
|
|
||||||
for (ix = -16415; lx>0; lx<<=1) ix -=1;
|
|
||||||
} else {
|
|
||||||
for (ix = -16383; hx>0; hx<<=1) ix -=1;
|
|
||||||
}
|
|
||||||
return ix;
|
|
||||||
}
|
|
||||||
else if (es<0x7fff) return es-0x3fff;
|
|
||||||
else if (FP_ILOGBNAN != INT_MAX)
|
|
||||||
{
|
|
||||||
GET_LDOUBLE_WORDS(es,hx,lx,x);
|
|
||||||
if (((hx & 0x7fffffff)|lx) == 0)
|
|
||||||
/* ISO C99 requires ilogbl(+-Inf) == INT_MAX. */
|
|
||||||
return INT_MAX;
|
|
||||||
}
|
|
||||||
return FP_ILOGBNAN;
|
|
||||||
}
|
|
|
@ -1,72 +0,0 @@
|
||||||
/* e_remainderl.c -- long double version of e_remainder.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.
|
|
||||||
* ====================================================
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* __ieee754_remainderl(x,p)
|
|
||||||
* Return :
|
|
||||||
* returns x REM p = x - [x/p]*p as if in infinite
|
|
||||||
* precise arithmetic, where [x/p] is the (infinite bit)
|
|
||||||
* integer nearest x/p (in half way case choose the even one).
|
|
||||||
* Method :
|
|
||||||
* Based on fmod() return x-[x/p]chopped*p exactlp.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
#include <math_private.h>
|
|
||||||
|
|
||||||
static const long double zero = 0.0;
|
|
||||||
|
|
||||||
|
|
||||||
long double
|
|
||||||
__ieee754_remainderl(long double x, long double p)
|
|
||||||
{
|
|
||||||
u_int32_t sx,sex,sep,x0,x1,p0,p1;
|
|
||||||
long double p_half;
|
|
||||||
|
|
||||||
GET_LDOUBLE_WORDS(sex,x0,x1,x);
|
|
||||||
GET_LDOUBLE_WORDS(sep,p0,p1,p);
|
|
||||||
sx = sex&0x8000;
|
|
||||||
sep &= 0x7fff;
|
|
||||||
sex &= 0x7fff;
|
|
||||||
|
|
||||||
/* purge off exception values */
|
|
||||||
if((sep|p0|p1)==0) return (x*p)/(x*p); /* p = 0 */
|
|
||||||
if((sex==0x7fff)|| /* x not finite */
|
|
||||||
((sep==0x7fff)&& /* p is NaN */
|
|
||||||
((p0|p1)!=0)))
|
|
||||||
return (x*p)/(x*p);
|
|
||||||
|
|
||||||
|
|
||||||
if (sep<0x7ffe) x = __ieee754_fmodl(x,p+p); /* now x < 2p */
|
|
||||||
if (((sex-sep)|(x0-p0)|(x1-p1))==0) return zero*x;
|
|
||||||
x = fabsl(x);
|
|
||||||
p = fabsl(p);
|
|
||||||
if (sep<0x0002) {
|
|
||||||
if(x+x>p) {
|
|
||||||
x-=p;
|
|
||||||
if(x+x>=p) x -= p;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
p_half = 0.5*p;
|
|
||||||
if(x>p_half) {
|
|
||||||
x-=p;
|
|
||||||
if(x>=p_half) x -= p;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
GET_LDOUBLE_EXP(sex,x);
|
|
||||||
SET_LDOUBLE_EXP(x,sex^sx);
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
strong_alias (__ieee754_remainderl, __remainderl_finite)
|
|
|
@ -1,85 +0,0 @@
|
||||||
/* s_ceill.c -- long double version of s_ceil.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
|
|
||||||
|
|
||||||
/*
|
|
||||||
* ceill(x)
|
|
||||||
* Return x rounded toward -inf to integral value
|
|
||||||
* Method:
|
|
||||||
* Bit twiddling.
|
|
||||||
* Exception:
|
|
||||||
* Inexact flag raised if x not equal to ceil(x).
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
#include <math_private.h>
|
|
||||||
|
|
||||||
static const long double huge = 1.0e4930;
|
|
||||||
|
|
||||||
long double __ceill(long double x)
|
|
||||||
{
|
|
||||||
int32_t i1,j0;
|
|
||||||
u_int32_t i,j,se,i0,sx;
|
|
||||||
GET_LDOUBLE_WORDS(se,i0,i1,x);
|
|
||||||
sx = (se>>15)&1;
|
|
||||||
j0 = (se&0x7fff)-0x3fff;
|
|
||||||
if(j0<31) {
|
|
||||||
if(j0<0) { /* raise inexact if x != 0 */
|
|
||||||
if(huge+x>0.0) {/* return 0*sign(x) if |x|<1 */
|
|
||||||
if(sx) {se=0x8000;i0=0;i1=0;}
|
|
||||||
else if((i0|i1)!=0) { se=0x3fff;i0=0;i1=0;}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
i = (0x7fffffff)>>j0;
|
|
||||||
if(((i0&i)|i1)==0) return x; /* x is integral */
|
|
||||||
if(huge+x>0.0) { /* raise inexact flag */
|
|
||||||
if(sx==0) {
|
|
||||||
if (j0>0 && (i0+(0x80000000>>j0))>i0)
|
|
||||||
i0+=0x80000000>>j0;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
i = 0x7fffffff;
|
|
||||||
++se;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
i0 &= (~i); i1=0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (j0>62) {
|
|
||||||
if(j0==0x4000) return x+x; /* inf or NaN */
|
|
||||||
else return x; /* x is integral */
|
|
||||||
} else {
|
|
||||||
i = ((u_int32_t)(0xffffffff))>>(j0-31);
|
|
||||||
if((i1&i)==0) return x; /* x is integral */
|
|
||||||
if(huge+x>0.0) { /* raise inexact flag */
|
|
||||||
if(sx==0) {
|
|
||||||
if(j0==31) i0+=1;
|
|
||||||
else {
|
|
||||||
j = i1 + (1<<(63-j0));
|
|
||||||
if(j<i1) i0+=1; /* got a carry */
|
|
||||||
i1 = j;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
i1 &= (~i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
SET_LDOUBLE_WORDS(x,se,i0,i1);
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
weak_alias (__ceill, ceill)
|
|
|
@ -1,35 +0,0 @@
|
||||||
/* s_fabsl.c -- long double version of s_fabs.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
|
|
||||||
|
|
||||||
/*
|
|
||||||
* fabsl(x) returns the absolute value of x.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
#include <math_private.h>
|
|
||||||
|
|
||||||
long double __fabsl(long double x)
|
|
||||||
{
|
|
||||||
u_int32_t exp;
|
|
||||||
GET_LDOUBLE_EXP(exp,x);
|
|
||||||
SET_LDOUBLE_EXP(x,exp&0x7fff);
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
weak_alias (__fabsl, fabsl)
|
|
|
@ -1,36 +0,0 @@
|
||||||
/* s_finitel.c -- long double version of s_finite.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
|
|
||||||
|
|
||||||
/*
|
|
||||||
* finitel(x) returns 1 is x is finite, else 0;
|
|
||||||
* no branching!
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
#include <math_private.h>
|
|
||||||
|
|
||||||
int __finitel(long double x)
|
|
||||||
{
|
|
||||||
int32_t exp;
|
|
||||||
GET_LDOUBLE_EXP(exp,x);
|
|
||||||
return (int)((u_int32_t)((exp&0x7fff)-0x7fff)>>31);
|
|
||||||
}
|
|
||||||
hidden_def (__finitel)
|
|
||||||
weak_alias (__finitel, finitel)
|
|
|
@ -1,86 +0,0 @@
|
||||||
/* s_floorl.c -- long double version of s_floor.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
|
|
||||||
|
|
||||||
/*
|
|
||||||
* floorl(x)
|
|
||||||
* Return x rounded toward -inf to integral value
|
|
||||||
* Method:
|
|
||||||
* Bit twiddling.
|
|
||||||
* Exception:
|
|
||||||
* Inexact flag raised if x not equal to floor(x).
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
#include <math_private.h>
|
|
||||||
|
|
||||||
static const long double huge = 1.0e4930;
|
|
||||||
|
|
||||||
long double __floorl(long double x)
|
|
||||||
{
|
|
||||||
int32_t i1,j0;
|
|
||||||
u_int32_t i,j,se,i0,sx;
|
|
||||||
GET_LDOUBLE_WORDS(se,i0,i1,x);
|
|
||||||
sx = (se>>15)&1;
|
|
||||||
j0 = (se&0x7fff)-0x3fff;
|
|
||||||
if(j0<31) {
|
|
||||||
if(j0<0) { /* raise inexact if x != 0 */
|
|
||||||
if(huge+x>0.0) {/* return 0*sign(x) if |x|<1 */
|
|
||||||
if(sx==0) {se=0;i0=i1=0;}
|
|
||||||
else if(((se&0x7fff)|i0|i1)!=0)
|
|
||||||
{ se=0xbfff;i0=i1=0;}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
i = (0x7fffffff)>>j0;
|
|
||||||
if(((i0&i)|i1)==0) return x; /* x is integral */
|
|
||||||
if(huge+x>0.0) { /* raise inexact flag */
|
|
||||||
if(sx) {
|
|
||||||
if (j0>0 && (i0+(0x80000000>>j0))>i0)
|
|
||||||
i0 += (0x80000000)>>j0;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
i = 0x7fffffff;
|
|
||||||
++se;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
i0 &= (~i); i1=0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (j0>62) {
|
|
||||||
if(j0==0x4000) return x+x; /* inf or NaN */
|
|
||||||
else return x; /* x is integral */
|
|
||||||
} else {
|
|
||||||
i = ((u_int32_t)(0xffffffff))>>(j0-31);
|
|
||||||
if((i1&i)==0) return x; /* x is integral */
|
|
||||||
if(huge+x>0.0) { /* raise inexact flag */
|
|
||||||
if(sx) {
|
|
||||||
if(j0==31) i0+=1;
|
|
||||||
else {
|
|
||||||
j = i1+(1<<(63-j0));
|
|
||||||
if(j<i1) i0 +=1 ; /* got a carry */
|
|
||||||
i1=j;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
i1 &= (~i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
SET_LDOUBLE_WORDS(x,se,i0,i1);
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
weak_alias (__floorl, floorl)
|
|
|
@ -1,44 +0,0 @@
|
||||||
/* Return classification value corresponding to argument.
|
|
||||||
Copyright (C) 1997-2013 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
|
||||||
Fixed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>.
|
|
||||||
|
|
||||||
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/>. */
|
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
#include <math_private.h>
|
|
||||||
|
|
||||||
|
|
||||||
int
|
|
||||||
__fpclassifyl (long double x)
|
|
||||||
{
|
|
||||||
u_int32_t ex, hx, lx, m;
|
|
||||||
int retval = FP_NORMAL;
|
|
||||||
|
|
||||||
GET_LDOUBLE_WORDS (ex, hx, lx, x);
|
|
||||||
m = (hx & 0x7fffffff) | lx;
|
|
||||||
ex &= 0x7fff;
|
|
||||||
if ((ex | m) == 0)
|
|
||||||
retval = FP_ZERO;
|
|
||||||
else if (ex == 0 && (hx & 0x80000000) == 0)
|
|
||||||
retval = FP_SUBNORMAL;
|
|
||||||
else if (ex == 0x7fff)
|
|
||||||
retval = m != 0 ? FP_NAN : FP_INFINITE;
|
|
||||||
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
libm_hidden_def (__fpclassifyl)
|
|
|
@ -1,30 +0,0 @@
|
||||||
/*
|
|
||||||
* Written by J.T. Conklin <jtc@netbsd.org>.
|
|
||||||
* Change for long double by Ulrich Drepper <drepper@cygnus.com>.
|
|
||||||
* Public domain.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if defined(LIBM_SCCS) && !defined(lint)
|
|
||||||
static char rcsid[] = "$NetBSD: $";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* isinfl(x) returns 1 if x is inf, -1 if x is -inf, else 0;
|
|
||||||
* no branching!
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
#include <math_private.h>
|
|
||||||
|
|
||||||
int
|
|
||||||
__isinfl (long double x)
|
|
||||||
{
|
|
||||||
int32_t se,hx,lx;
|
|
||||||
GET_LDOUBLE_WORDS(se,hx,lx,x);
|
|
||||||
lx |= (hx & 0x7fffffff) | ((se & 0x7fff) ^ 0x7fff);
|
|
||||||
lx |= -lx;
|
|
||||||
se &= 0x8000;
|
|
||||||
return ~(lx >> 31) & (1 - (se >> 14));
|
|
||||||
}
|
|
||||||
hidden_def (__isinfl)
|
|
||||||
weak_alias (__isinfl, isinfl)
|
|
|
@ -1,40 +0,0 @@
|
||||||
/* s_isnanl.c -- long double version of s_isnan.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
|
|
||||||
|
|
||||||
/*
|
|
||||||
* isnanl(x) returns 1 is x is nan, else 0;
|
|
||||||
* no branching!
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
#include <math_private.h>
|
|
||||||
|
|
||||||
int __isnanl(long double x)
|
|
||||||
{
|
|
||||||
int32_t se,hx,lx;
|
|
||||||
GET_LDOUBLE_WORDS(se,hx,lx,x);
|
|
||||||
se = (se & 0x7fff) << 1;
|
|
||||||
lx |= hx & 0x7fffffff;
|
|
||||||
se |= (u_int32_t)(lx|(-lx))>>31;
|
|
||||||
se = 0xfffe - se;
|
|
||||||
return (int)(((u_int32_t)(se))>>31);
|
|
||||||
}
|
|
||||||
hidden_def (__isnanl)
|
|
||||||
weak_alias (__isnanl, isnanl)
|
|
|
@ -1,51 +0,0 @@
|
||||||
/* s_logbl.c -- long double version of s_logb.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.
|
|
||||||
* ====================================================
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* long double logbl(x)
|
|
||||||
* IEEE 754 logb. Included to pass IEEE test suite. Not recommend.
|
|
||||||
* Use ilogb instead.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
#include <math_private.h>
|
|
||||||
|
|
||||||
long double
|
|
||||||
__logbl (long double x)
|
|
||||||
{
|
|
||||||
int32_t es, lx, ix;
|
|
||||||
|
|
||||||
GET_LDOUBLE_WORDS (es, ix, lx, x);
|
|
||||||
es &= 0x7fff; /* exponent */
|
|
||||||
if ((es | ix | lx) == 0)
|
|
||||||
return -1.0 / fabs (x);
|
|
||||||
if (es == 0x7fff)
|
|
||||||
return x * x;
|
|
||||||
if (es == 0) /* IEEE 754 logb */
|
|
||||||
{
|
|
||||||
/* POSIX specifies that denormal number is treated as
|
|
||||||
though it were normalized. */
|
|
||||||
int ma;
|
|
||||||
if (ix == 0)
|
|
||||||
ma = __builtin_clz (lx) + 32;
|
|
||||||
else
|
|
||||||
ma = __builtin_clz (ix);
|
|
||||||
es -= ma - 1;
|
|
||||||
}
|
|
||||||
return (long double) (es - 16383);
|
|
||||||
}
|
|
||||||
|
|
||||||
weak_alias (__logbl, logbl)
|
|
|
@ -1,88 +0,0 @@
|
||||||
/* s_rintl.c -- long double version of s_rint.c.
|
|
||||||
* Conversion to long double by Ulrich Drepper,
|
|
||||||
* Cygnus Support, drepper@cygnus.com.
|
|
||||||
*/
|
|
||||||
/* Adapted for use as nearbyint by Ulrich Drepper <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.
|
|
||||||
* ====================================================
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* rintl(x)
|
|
||||||
* Return x rounded to integral value according to the prevailing
|
|
||||||
* rounding mode.
|
|
||||||
* Method:
|
|
||||||
* Using floating addition.
|
|
||||||
* Exception:
|
|
||||||
* Inexact flag raised if x not equal to rintl(x).
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <fenv.h>
|
|
||||||
#include <math.h>
|
|
||||||
#include <math_private.h>
|
|
||||||
|
|
||||||
static const long double
|
|
||||||
TWO63[2]={
|
|
||||||
9.223372036854775808000000e+18, /* 0x403E, 0x00000000, 0x00000000 */
|
|
||||||
-9.223372036854775808000000e+18 /* 0xC03E, 0x00000000, 0x00000000 */
|
|
||||||
};
|
|
||||||
|
|
||||||
long double __nearbyintl(long double x)
|
|
||||||
{
|
|
||||||
fenv_t env;
|
|
||||||
int32_t se,j0,sx;
|
|
||||||
u_int32_t i,i0,i1;
|
|
||||||
long double w,t;
|
|
||||||
GET_LDOUBLE_WORDS(se,i0,i1,x);
|
|
||||||
sx = (se>>15)&1;
|
|
||||||
j0 = (se&0x7fff)-0x3fff;
|
|
||||||
if(j0<31) {
|
|
||||||
if(j0<0) {
|
|
||||||
if(((se&0x7fff)|i0|i1)==0) return x;
|
|
||||||
i1 |= i0;
|
|
||||||
i0 &= 0xe0000000;
|
|
||||||
i0 |= (i1|-i1)&0x80000000;
|
|
||||||
SET_LDOUBLE_MSW(x,i0);
|
|
||||||
feholdexcept (&env);
|
|
||||||
w = TWO63[sx]+x;
|
|
||||||
t = w-TWO63[sx];
|
|
||||||
math_force_eval (t);
|
|
||||||
fesetenv (&env);
|
|
||||||
GET_LDOUBLE_EXP(i0,t);
|
|
||||||
SET_LDOUBLE_EXP(t,(i0&0x7fff)|(sx<<15));
|
|
||||||
return t;
|
|
||||||
} else {
|
|
||||||
i = (0x7fffffff)>>j0;
|
|
||||||
if(((i0&i)|i1)==0) return x; /* x is integral */
|
|
||||||
i>>=1;
|
|
||||||
if(((i0&i)|i1)!=0) {
|
|
||||||
if (j0==30) i1 = 0x40000000; else
|
|
||||||
i0 = (i0&(~i))|((0x20000000)>>j0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (j0>62) {
|
|
||||||
if(j0==0x4000) return x+x; /* inf or NaN */
|
|
||||||
else return x; /* x is integral */
|
|
||||||
} else {
|
|
||||||
i = ((u_int32_t)(0xffffffff))>>(j0-31);
|
|
||||||
if((i1&i)==0) return x; /* x is integral */
|
|
||||||
i>>=1;
|
|
||||||
if((i1&i)!=0) i1 = (i1&(~i))|((0x40000000)>>(j0-31));
|
|
||||||
}
|
|
||||||
SET_LDOUBLE_WORDS(x,se,i0,i1);
|
|
||||||
feholdexcept (&env);
|
|
||||||
w = TWO63[sx]+x;
|
|
||||||
t = w-TWO63[sx];
|
|
||||||
math_force_eval (t);
|
|
||||||
fesetenv (&env);
|
|
||||||
return t;
|
|
||||||
}
|
|
||||||
weak_alias (__nearbyintl, nearbyintl)
|
|
|
@ -1,96 +0,0 @@
|
||||||
/* s_nextafterl.c -- long double version of s_nextafter.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
|
|
||||||
|
|
||||||
/* IEEE functions
|
|
||||||
* nextafterl(x,y)
|
|
||||||
* return the next machine floating-point number of x in the
|
|
||||||
* direction toward y.
|
|
||||||
* Special cases:
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
#include <math_private.h>
|
|
||||||
|
|
||||||
long double __nextafterl(long double x, long double y)
|
|
||||||
{
|
|
||||||
int32_t hx,hy,ix,iy;
|
|
||||||
u_int32_t lx,ly,esx,esy;
|
|
||||||
|
|
||||||
GET_LDOUBLE_WORDS(esx,hx,lx,x);
|
|
||||||
GET_LDOUBLE_WORDS(esy,hy,ly,y);
|
|
||||||
ix = esx&0x7fff; /* |x| */
|
|
||||||
iy = esy&0x7fff; /* |y| */
|
|
||||||
|
|
||||||
if (((ix==0x7fff)&&((hx|lx)!=0)) || /* x is nan */
|
|
||||||
((iy==0x7fff)&&((hy|ly)!=0))) /* y is nan */
|
|
||||||
return x+y;
|
|
||||||
if(x==y) return y; /* x=y, return y */
|
|
||||||
if((ix|hx|lx)==0) { /* x == 0 */
|
|
||||||
long double u;
|
|
||||||
SET_LDOUBLE_WORDS(x,esy&0x8000,0,1);/* return +-minsubnormal */
|
|
||||||
u = math_opt_barrier (x);
|
|
||||||
u = u * u;
|
|
||||||
math_force_eval (u); /* raise underflow flag */
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
if(esx<0x8000) { /* x > 0 */
|
|
||||||
if(ix>iy||((ix==iy) && (hx>hy||((hx==hy)&&(lx>ly))))) {
|
|
||||||
/* x > y, x -= ulp */
|
|
||||||
if(lx==0) {
|
|
||||||
if (hx==0) esx -= 1;
|
|
||||||
hx -= 1;
|
|
||||||
}
|
|
||||||
lx -= 1;
|
|
||||||
} else { /* x < y, x += ulp */
|
|
||||||
lx += 1;
|
|
||||||
if(lx==0) {
|
|
||||||
hx += 1;
|
|
||||||
if (hx==0)
|
|
||||||
esx += 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else { /* x < 0 */
|
|
||||||
if(esy>=0||(ix>iy||((ix==iy)&&(hx>hy||((hx==hy)&&(lx>ly)))))){
|
|
||||||
/* x < y, x -= ulp */
|
|
||||||
if(lx==0) {
|
|
||||||
if (hx==0) esx -= 1;
|
|
||||||
hx -= 1;
|
|
||||||
}
|
|
||||||
lx -= 1;
|
|
||||||
} else { /* x > y, x += ulp */
|
|
||||||
lx += 1;
|
|
||||||
if(lx==0) {
|
|
||||||
hx += 1;
|
|
||||||
if (hx==0) esx += 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
esy = esx&0x7fff;
|
|
||||||
if(esy==0x7fff) return x+x; /* overflow */
|
|
||||||
if(esy==0) {
|
|
||||||
long double u = x*x; /* underflow */
|
|
||||||
math_force_eval (u); /* raise underflow flag */
|
|
||||||
}
|
|
||||||
SET_LDOUBLE_WORDS(x,esx,hx,lx);
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
weak_alias (__nextafterl, nextafterl)
|
|
||||||
strong_alias (__nextafterl, __nexttowardl)
|
|
||||||
weak_alias (__nextafterl, nexttowardl)
|
|
|
@ -1,82 +0,0 @@
|
||||||
/* s_rintl.c -- long double version of s_rint.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
|
|
||||||
|
|
||||||
/*
|
|
||||||
* rintl(x)
|
|
||||||
* Return x rounded to integral value according to the prevailing
|
|
||||||
* rounding mode.
|
|
||||||
* Method:
|
|
||||||
* Using floating addition.
|
|
||||||
* Exception:
|
|
||||||
* Inexact flag raised if x not equal to rintl(x).
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
#include <math_private.h>
|
|
||||||
|
|
||||||
static const long double
|
|
||||||
TWO63[2]={
|
|
||||||
9.223372036854775808000000e+18, /* 0x403E, 0x00000000, 0x00000000 */
|
|
||||||
-9.223372036854775808000000e+18 /* 0xC03E, 0x00000000, 0x00000000 */
|
|
||||||
};
|
|
||||||
|
|
||||||
long double __rintl(long double x)
|
|
||||||
{
|
|
||||||
int32_t se,j0,sx;
|
|
||||||
u_int32_t i,i0,i1;
|
|
||||||
long double w,t;
|
|
||||||
GET_LDOUBLE_WORDS(se,i0,i1,x);
|
|
||||||
sx = (se>>15)&1;
|
|
||||||
j0 = (se&0x7fff)-0x3fff;
|
|
||||||
if(j0<31) {
|
|
||||||
if(j0<0) {
|
|
||||||
if(((se&0x7fff)|i0|i1)==0) return x;
|
|
||||||
i1 |= i0;
|
|
||||||
i0 &= 0xe0000000;
|
|
||||||
i0 |= (i1|-i1)&0x80000000;
|
|
||||||
SET_LDOUBLE_MSW(x,i0);
|
|
||||||
w = TWO63[sx]+x;
|
|
||||||
t = w-TWO63[sx];
|
|
||||||
GET_LDOUBLE_EXP(i0,t);
|
|
||||||
SET_LDOUBLE_EXP(t,(i0&0x7fff)|(sx<<15));
|
|
||||||
return t;
|
|
||||||
} else {
|
|
||||||
i = (0x7fffffff)>>j0;
|
|
||||||
if(((i0&i)|i1)==0) return x; /* x is integral */
|
|
||||||
i>>=1;
|
|
||||||
if(((i0&i)|i1)!=0) {
|
|
||||||
if(j0==30) i1 = 0x40000000; else
|
|
||||||
i0 = (i0&(~i))|((0x20000000)>>j0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (j0>62) {
|
|
||||||
if(j0==0x4000) return x+x; /* inf or NaN */
|
|
||||||
else return x; /* x is integral */
|
|
||||||
} else {
|
|
||||||
i = ((u_int32_t)(0xffffffff))>>(j0-31);
|
|
||||||
if((i1&i)==0) return x; /* x is integral */
|
|
||||||
i>>=1;
|
|
||||||
if((i1&i)!=0) i1 = (i1&(~i))|((0x40000000)>>(j0-31));
|
|
||||||
}
|
|
||||||
SET_LDOUBLE_WORDS(x,se,i0,i1);
|
|
||||||
w = TWO63[sx]+x;
|
|
||||||
return w-TWO63[sx];
|
|
||||||
}
|
|
||||||
weak_alias (__rintl, rintl)
|
|
|
@ -1,61 +0,0 @@
|
||||||
/* s_scalbnl.c -- long double version of s_scalbn.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.
|
|
||||||
* ====================================================
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* scalbnl (long double x, int n)
|
|
||||||
* scalbnl(x,n) returns x* 2**n computed by exponent
|
|
||||||
* manipulation rather than by actually performing an
|
|
||||||
* exponentiation or a multiplication.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
#include <math_private.h>
|
|
||||||
|
|
||||||
static const long double
|
|
||||||
two64 = 1.8446744073709551616e19L,
|
|
||||||
twom64 = 5.421010862427522170037e-20L,
|
|
||||||
huge = 1.0e+4900L,
|
|
||||||
tiny = 1.0e-4900L;
|
|
||||||
|
|
||||||
long double
|
|
||||||
__scalbnl (long double x, int n)
|
|
||||||
{
|
|
||||||
int32_t k,es,hx,lx;
|
|
||||||
GET_LDOUBLE_WORDS(es,hx,lx,x);
|
|
||||||
k = es&0x7fff; /* extract exponent */
|
|
||||||
if (__builtin_expect(k==0, 0)) { /* 0 or subnormal x */
|
|
||||||
if ((lx|(hx&0x7fffffff))==0) return x; /* +-0 */
|
|
||||||
x *= two64;
|
|
||||||
GET_LDOUBLE_EXP(hx,x);
|
|
||||||
k = (hx&0x7fff) - 64;
|
|
||||||
}
|
|
||||||
if (__builtin_expect(k==0x7fff, 0)) return x+x; /* NaN or Inf */
|
|
||||||
if (__builtin_expect(n< -50000, 0))
|
|
||||||
return tiny*__copysignl(tiny,x);
|
|
||||||
if (__builtin_expect(n> 50000 || k+n > 0x7ffe, 0))
|
|
||||||
return huge*__copysignl(huge,x); /* overflow */
|
|
||||||
/* Now k and n are bounded we know that k = k+n does not
|
|
||||||
overflow. */
|
|
||||||
k = k+n;
|
|
||||||
if (__builtin_expect(k > 0, 1)) /* normal result */
|
|
||||||
{SET_LDOUBLE_EXP(x,(es&0x8000)|k); return x;}
|
|
||||||
if (k <= -64)
|
|
||||||
return tiny*__copysignl(tiny,x); /*underflow*/
|
|
||||||
k += 64; /* subnormal result */
|
|
||||||
SET_LDOUBLE_EXP(x,(es&0x8000)|k);
|
|
||||||
return x*twom64;
|
|
||||||
}
|
|
||||||
weak_alias (__scalbnl, scalbnl)
|
|
|
@ -1,56 +0,0 @@
|
||||||
/* Truncate argument to nearest integral value not larger than the argument.
|
|
||||||
Copyright (C) 1997-2013 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
|
||||||
|
|
||||||
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/>. */
|
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
#include <math_private.h>
|
|
||||||
|
|
||||||
|
|
||||||
long double
|
|
||||||
__truncl (long double x)
|
|
||||||
{
|
|
||||||
int32_t i0, j0;
|
|
||||||
u_int32_t se, i1;
|
|
||||||
int sx;
|
|
||||||
|
|
||||||
GET_LDOUBLE_WORDS (se, i0, i1, x);
|
|
||||||
sx = se & 0x8000;
|
|
||||||
j0 = (se & 0x7fff) - 0x3fff;
|
|
||||||
if (j0 < 31)
|
|
||||||
{
|
|
||||||
if (j0 < 0)
|
|
||||||
/* The magnitude of the number is < 1 so the result is +-0. */
|
|
||||||
SET_LDOUBLE_WORDS (x, sx, 0, 0);
|
|
||||||
else
|
|
||||||
SET_LDOUBLE_WORDS (x, se, i0 & ~(0x7fffffff >> j0), 0);
|
|
||||||
}
|
|
||||||
else if (j0 > 63)
|
|
||||||
{
|
|
||||||
if (j0 == 0x4000)
|
|
||||||
/* x is inf or NaN. */
|
|
||||||
return x + x;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SET_LDOUBLE_WORDS (x, se, i0, i1 & ~(0xffffffffu >> (j0 - 31)));
|
|
||||||
}
|
|
||||||
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
weak_alias (__truncl, truncl)
|
|
Loading…
Reference in New Issue