From 7799b7b3350fdcadc6dfb8821fb49b7772c96701 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Tue, 15 Apr 1997 01:38:39 +0000 Subject: Update. 1997-04-15 03:14 Ulrich Drepper * wcsmbs/wcsstr.c: Add weak alias wcswcs for Unix98 compliance. * math/Makefile (libm-calls): Add s_sincos and s_cproj. * math/mathcalls.h: Add prototype for sincos. * sysdeps/i386/fpu/__math.h: Warn about restriction on arguments to inlined sin and cos function. Define functions new in ISO C 9X when __USE_ISOC9X is defined. Add optimized version of finite. Rewrite sincos function to handle too large arguments. * sysdeps/libm-i387/s_cos.S: Better code alignment. * sysdeps/libm-i387/s_cosl.S: Likewise. * sysdeps/libm-i387/s_sin.S: Likewise. * sysdeps/libm-i387/s_sinl.S: Likewise. * sysdeps/libm-i387/s_finite.S: Yet better code. * sysdeps/libm-i387/s_finitef.S: Likewise. * sysdeps/libm-i387/s_sincos.S: New file. * sysdeps/libm-i387/s_sincosf.S: New file. * sysdeps/libm-i387/s_sincosl.S: New file. * sysdeps/libm-ieee754/s_sincos.c: New file. * sysdeps/libm-ieee754/s_sincosf.c: New file. * sysdeps/libm-ieee754/s_sincosl.c: New file. * sysdeps/libm-ieee754/s_ccosh.c: Change to use sincos function. * sysdeps/libm-ieee754/s_ccoshf.c: Likewise. * sysdeps/libm-ieee754/s_ccoshl.c: Likewise. * sysdeps/libm-ieee754/s_cexp.c: Likewise. * sysdeps/libm-ieee754/s_cexpf.c: Likewise. * sysdeps/libm-ieee754/s_cexpl.c: Likewise. * sysdeps/libm-ieee754/s_csinh.c: Likewise. * sysdeps/libm-ieee754/s_csinhf.c: Likewise. * sysdeps/libm-ieee754/s_csinhl.c: Likewise. * sysdeps/libm-ieee754/s_ctan.c: Likewise. * sysdeps/libm-ieee754/s_ctanf.c: Likewise. * sysdeps/libm-ieee754/s_ctanl.c: Likewise. * sysdeps/libm-ieee754/s_ctanh.c: Likewise. * sysdeps/libm-ieee754/s_ctanhf.c: Likewise. * sysdeps/libm-ieee754/s_ctanhl.c: Likewise. * sysdeps/libm-ieee754/s_cosl.c: Correct check for range. * sysdeps/libm-ieee754/s_sinl.c: Likewise. * sysdeps/libm-ieee754/s_roundtol.c: Fix typos. * sysdeps/libm-ieee754/s_roundtoll.c: Likewise. * nis/Makefile (services): Mention nisplus before compat. * nis/nis_call.c (__do_niscall): Change type of variable server_len to prevent warning. * nis/nss_compat/compat-grp.c (getgrent_next_file_plusgroup): Add cast to prevent warning. * nis/nss_compat/compat-pwd.c (getpwent_next_file_plususer): Likewise. * nis/nss_compat/compat-spwd.c (getspent_next_file_plususer): Likewise. * nis/nss_nisplus/nisplus-hosts.c (_nss_nisplus_parse_hostent): Change type of variable `i' to prevent warning. * nis/nss_nisplus/nisplus-network.c (_nss_nisplus_parse_netent): Likewise. * nis/nss_nisplus/nisplus-proto.c (_nss_nisplus_parse_protoent): Likewise. * nis/nss_nisplus/nisplus-rpc.c (_nss_nisplus_parse_rpcent): Likewise. * nis/nss_nisplus/nisplus-service.c (_nss_nisplus_parse_servent): Likewise. * sysdeps/generic/Dist: Remove old math implementation files. * sysdeps/generic/mathimpl.h: Removed. * sysdeps/generic/trig.h: Removed. * sysdeps/generic/sincos.c: Removed. * sysdeps/generic/asincos.c: Removed. * sysdeps/generic/exp__E.c: Removed. * sysdeps/generic/log__L.c: Removed. 1997-04-13 17:18 Wolfram Gloger * malloc/malloc.c (fREe): Small optimization. Before returning, add fast check whether the heap containing top can go away. 1997-04-11 16:46 Wolfram Gloger * malloc/malloc.c (mALLOc, rEALLOc, cALLOc, mEMALIGn): When failing to allocate a new chunk, also try the main_arena. It may be that we are only running out of mmapped regions, and other arenas cannot be enlarged sufficiently. (new_heap, malloc_extend_top): Handle top_pad more consistently, i.e. only in new_heap(). 1997-04-13 21:10 Philip Blundell * sysdeps/posix/Makefile: Don't try to build and run mk-stdiolim if cross-compiling. * configure.in: Recognise "...linuxaout" OS names and turn off ELF. * configure.in: Add ARM support. * sysdeps/arm/Implies: New file. * sysdeps/arm/__longjmp.S: New file. * sysdeps/arm/bsd-_setjmp: New file. * sysdeps/arm/bsd-setjmp: New file. * sysdeps/arm/bytesex.h: New file. * sysdeps/arm/fpu_control.h: New file. * sysdeps/arm/jmp_buf.h: New file. * sysdeps/arm/setjmp.h: New file. * sysdeps/arm/sysdep.h: New file. * sysdeps/unix/arm/config.h: New file. 1997-04-14 04:03 Ulrich Drepper * sysdeps/libm-ieee754/s_cproj.c: New file. * sysdeps/libm-ieee754/s_cprojf.c: New file. * sysdeps/libm-ieee754/s_cprojl.c: New file. --- sysdeps/generic/Dist | 6 -- sysdeps/generic/asincos.c | 169 ----------------------------------- sysdeps/generic/exp__E.c | 136 ---------------------------- sysdeps/generic/log__L.c | 110 ----------------------- sysdeps/generic/mathimpl.h | 127 -------------------------- sysdeps/generic/sincos.c | 98 --------------------- sysdeps/generic/trig.h | 215 --------------------------------------------- 7 files changed, 861 deletions(-) delete mode 100644 sysdeps/generic/asincos.c delete mode 100644 sysdeps/generic/exp__E.c delete mode 100644 sysdeps/generic/log__L.c delete mode 100644 sysdeps/generic/mathimpl.h delete mode 100644 sysdeps/generic/sincos.c delete mode 100644 sysdeps/generic/trig.h (limited to 'sysdeps/generic') diff --git a/sysdeps/generic/Dist b/sysdeps/generic/Dist index 2431f7b..e82624a 100644 --- a/sysdeps/generic/Dist +++ b/sysdeps/generic/Dist @@ -1,8 +1,2 @@ make_siglist.c signame.c signame.h det_endian.c -mathimpl.h -trig.h -sincos.c -asincos.c -exp__E.c -log__L.c diff --git a/sysdeps/generic/asincos.c b/sysdeps/generic/asincos.c deleted file mode 100644 index c746b16..0000000 --- a/sysdeps/generic/asincos.c +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Copyright (c) 1985, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -static char sccsid[] = "@(#)asincos.c 8.1 (Berkeley) 6/4/93"; -#endif /* not lint */ - -/* ASIN(X) - * RETURNS ARC SINE OF X - * DOUBLE PRECISION (IEEE DOUBLE 53 bits, VAX D FORMAT 56 bits) - * CODED IN C BY K.C. NG, 4/16/85, REVISED ON 6/10/85. - * - * Required system supported functions: - * copysign(x,y) - * sqrt(x) - * - * Required kernel function: - * atan2(y,x) - * - * Method : - * asin(x) = atan2(x,sqrt(1-x*x)); for better accuracy, 1-x*x is - * computed as follows - * 1-x*x if x < 0.5, - * 2*(1-|x|)-(1-|x|)*(1-|x|) if x >= 0.5. - * - * Special cases: - * if x is NaN, return x itself; - * if |x|>1, return NaN. - * - * Accuracy: - * 1) If atan2() uses machine PI, then - * - * asin(x) returns (PI/pi) * (the exact arc sine of x) nearly rounded; - * and PI is the exact pi rounded to machine precision (see atan2 for - * details): - * - * in decimal: - * pi = 3.141592653589793 23846264338327 ..... - * 53 bits PI = 3.141592653589793 115997963 ..... , - * 56 bits PI = 3.141592653589793 227020265 ..... , - * - * in hexadecimal: - * pi = 3.243F6A8885A308D313198A2E.... - * 53 bits PI = 3.243F6A8885A30 = 2 * 1.921FB54442D18 error=.276ulps - * 56 bits PI = 3.243F6A8885A308 = 4 * .C90FDAA22168C2 error=.206ulps - * - * In a test run with more than 200,000 random arguments on a VAX, the - * maximum observed error in ulps (units in the last place) was - * 2.06 ulps. (comparing against (PI/pi)*(exact asin(x))); - * - * 2) If atan2() uses true pi, then - * - * asin(x) returns the exact asin(x) with error below about 2 ulps. - * - * In a test run with more than 1,024,000 random arguments on a VAX, the - * maximum observed error in ulps (units in the last place) was - * 1.99 ulps. - */ - -double asin(x) -double x; -{ - double s,t,copysign(),atan2(),sqrt(),one=1.0; -#if !defined(vax)&&!defined(tahoe) - if(x!=x) return(x); /* x is NaN */ -#endif /* !defined(vax)&&!defined(tahoe) */ - s=copysign(x,one); - if(s <= 0.5) - return(atan2(x,sqrt(one-x*x))); - else - { t=one-s; s=t+t; return(atan2(x,sqrt(s-t*t))); } - -} - -/* ACOS(X) - * RETURNS ARC COS OF X - * DOUBLE PRECISION (IEEE DOUBLE 53 bits, VAX D FORMAT 56 bits) - * CODED IN C BY K.C. NG, 4/16/85, REVISED ON 6/10/85. - * - * Required system supported functions: - * copysign(x,y) - * sqrt(x) - * - * Required kernel function: - * atan2(y,x) - * - * Method : - * ________ - * / 1 - x - * acos(x) = 2*atan2( / -------- , 1 ) . - * \/ 1 + x - * - * Special cases: - * if x is NaN, return x itself; - * if |x|>1, return NaN. - * - * Accuracy: - * 1) If atan2() uses machine PI, then - * - * acos(x) returns (PI/pi) * (the exact arc cosine of x) nearly rounded; - * and PI is the exact pi rounded to machine precision (see atan2 for - * details): - * - * in decimal: - * pi = 3.141592653589793 23846264338327 ..... - * 53 bits PI = 3.141592653589793 115997963 ..... , - * 56 bits PI = 3.141592653589793 227020265 ..... , - * - * in hexadecimal: - * pi = 3.243F6A8885A308D313198A2E.... - * 53 bits PI = 3.243F6A8885A30 = 2 * 1.921FB54442D18 error=.276ulps - * 56 bits PI = 3.243F6A8885A308 = 4 * .C90FDAA22168C2 error=.206ulps - * - * In a test run with more than 200,000 random arguments on a VAX, the - * maximum observed error in ulps (units in the last place) was - * 2.07 ulps. (comparing against (PI/pi)*(exact acos(x))); - * - * 2) If atan2() uses true pi, then - * - * acos(x) returns the exact acos(x) with error below about 2 ulps. - * - * In a test run with more than 1,024,000 random arguments on a VAX, the - * maximum observed error in ulps (units in the last place) was - * 2.15 ulps. - */ - -double acos(x) -double x; -{ - double t,copysign(),atan2(),sqrt(),one=1.0; -#if !defined(vax)&&!defined(tahoe) - if(x!=x) return(x); -#endif /* !defined(vax)&&!defined(tahoe) */ - if( x != -1.0) - t=atan2(sqrt((one-x)/(one+x)),one); - else - t=atan2(one,0.0); /* t = PI/2 */ - return(t+t); -} diff --git a/sysdeps/generic/exp__E.c b/sysdeps/generic/exp__E.c deleted file mode 100644 index ab97247..0000000 --- a/sysdeps/generic/exp__E.c +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright (c) 1985, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -static char sccsid[] = "@(#)exp__E.c 8.1 (Berkeley) 6/4/93"; -#endif /* not lint */ - -/* exp__E(x,c) - * ASSUMPTION: c << x SO THAT fl(x+c)=x. - * (c is the correction term for x) - * exp__E RETURNS - * - * / exp(x+c) - 1 - x , 1E-19 < |x| < .3465736 - * exp__E(x,c) = | - * \ 0 , |x| < 1E-19. - * - * DOUBLE PRECISION (IEEE 53 bits, VAX D FORMAT 56 BITS) - * KERNEL FUNCTION OF EXP, EXPM1, POW FUNCTIONS - * CODED IN C BY K.C. NG, 1/31/85; - * REVISED BY K.C. NG on 3/16/85, 4/16/85. - * - * Required system supported function: - * copysign(x,y) - * - * Method: - * 1. Rational approximation. Let r=x+c. - * Based on - * 2 * sinh(r/2) - * exp(r) - 1 = ---------------------- , - * cosh(r/2) - sinh(r/2) - * exp__E(r) is computed using - * x*x (x/2)*W - ( Q - ( 2*P + x*P ) ) - * --- + (c + x*[---------------------------------- + c ]) - * 2 1 - W - * where P := p1*x^2 + p2*x^4, - * Q := q1*x^2 + q2*x^4 (for 56 bits precision, add q3*x^6) - * W := x/2-(Q-x*P), - * - * (See the listing below for the values of p1,p2,q1,q2,q3. The poly- - * nomials P and Q may be regarded as the approximations to sinh - * and cosh : - * sinh(r/2) = r/2 + r * P , cosh(r/2) = 1 + Q . ) - * - * The coefficients were obtained by a special Remez algorithm. - * - * Approximation error: - * - * | exp(x) - 1 | 2**(-57), (IEEE double) - * | ------------ - (exp__E(x,0)+x)/x | <= - * | x | 2**(-69). (VAX D) - * - * 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 "mathimpl.h" - -vc(p1, 1.5150724356786683059E-2 ,3abe,3d78,066a,67e1, -6, .F83ABE67E1066A) -vc(p2, 6.3112487873718332688E-5 ,5b42,3984,0173,48cd, -13, .845B4248CD0173) -vc(q1, 1.1363478204690669916E-1 ,b95a,3ee8,ec45,44a2, -3, .E8B95A44A2EC45) -vc(q2, 1.2624568129896839182E-3 ,7905,3ba5,f5e7,72e4, -9, .A5790572E4F5E7) -vc(q3, 1.5021856115869022674E-6 ,9eb4,36c9,c395,604a, -19, .C99EB4604AC395) - -ic(p1, 1.3887401997267371720E-2, -7, 1.C70FF8B3CC2CF) -ic(p2, 3.3044019718331897649E-5, -15, 1.15317DF4526C4) -ic(q1, 1.1110813732786649355E-1, -4, 1.C719538248597) -ic(q2, 9.9176615021572857300E-4, -10, 1.03FC4CB8C98E8) - -#ifdef vccast -#define p1 vccast(p1) -#define p2 vccast(p2) -#define q1 vccast(q1) -#define q2 vccast(q2) -#define q3 vccast(q3) -#endif - -double __exp__E(x,c) -double x,c; -{ - const static double zero=0.0, one=1.0, half=1.0/2.0, small=1.0E-19; - double z,p,q,xp,xh,w; - if(copysign(x,one)>small) { - z = x*x ; - p = z*( p1 +z* p2 ); -#if defined(vax)||defined(tahoe) - q = z*( q1 +z*( q2 +z* q3 )); -#else /* defined(vax)||defined(tahoe) */ - q = z*( q1 +z* q2 ); -#endif /* defined(vax)||defined(tahoe) */ - xp= x*p ; - xh= x*half ; - w = xh-(q-xp) ; - p = p+p; - c += x*((xh*w-(q-(p+xp)))/(one-w)+c); - return(z*half+c); - } - /* end of |x| > small */ - - else { - if(x!=zero) one+small; /* raise the inexact flag */ - return(copysign(zero,x)); - } -} diff --git a/sysdeps/generic/log__L.c b/sysdeps/generic/log__L.c deleted file mode 100644 index c00158f..0000000 --- a/sysdeps/generic/log__L.c +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 1985, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -static char sccsid[] = "@(#)log__L.c 8.1 (Berkeley) 6/4/93"; -#endif /* not lint */ - -/* log__L(Z) - * LOG(1+X) - 2S X - * RETURN --------------- WHERE Z = S*S, S = ------- , 0 <= Z <= .0294... - * S 2 + X - * - * DOUBLE PRECISION (VAX D FORMAT 56 bits or IEEE DOUBLE 53 BITS) - * KERNEL FUNCTION FOR LOG; TO BE USED IN LOG1P, LOG, AND POW FUNCTIONS - * CODED IN C BY K.C. NG, 1/19/85; - * REVISED BY K.C. Ng, 2/3/85, 4/16/85. - * - * Method : - * 1. Polynomial approximation: let s = x/(2+x). - * Based on log(1+x) = log(1+s) - log(1-s) - * = 2s + 2/3 s**3 + 2/5 s**5 + ....., - * - * (log(1+x) - 2s)/s is computed by - * - * z*(L1 + z*(L2 + z*(... (L7 + z*L8)...))) - * - * where z=s*s. (See the listing below for Lk's values.) The - * coefficients are obtained by a special Remez algorithm. - * - * Accuracy: - * Assuming no rounding error, the maximum magnitude of the approximation - * error (absolute) is 2**(-58.49) for IEEE double, and 2**(-63.63) - * for VAX D format. - * - * 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 "mathimpl.h" - -vc(L1, 6.6666666666666703212E-1 ,aaaa,402a,aac5,aaaa, 0, .AAAAAAAAAAAAC5) -vc(L2, 3.9999999999970461961E-1 ,cccc,3fcc,2684,cccc, -1, .CCCCCCCCCC2684) -vc(L3, 2.8571428579395698188E-1 ,4924,3f92,5782,92f8, -1, .92492492F85782) -vc(L4, 2.2222221233634724402E-1 ,8e38,3f63,af2c,39b7, -2, .E38E3839B7AF2C) -vc(L5, 1.8181879517064680057E-1 ,2eb4,3f3a,655e,cc39, -2, .BA2EB4CC39655E) -vc(L6, 1.5382888777946145467E-1 ,8551,3f1d,781d,e8c5, -2, .9D8551E8C5781D) -vc(L7, 1.3338356561139403517E-1 ,95b3,3f08,cd92,907f, -2, .8895B3907FCD92) -vc(L8, 1.2500000000000000000E-1 ,0000,3f00,0000,0000, -2, .80000000000000) - -ic(L1, 6.6666666666667340202E-1, -1, 1.5555555555592) -ic(L2, 3.9999999999416702146E-1, -2, 1.999999997FF24) -ic(L3, 2.8571428742008753154E-1, -2, 1.24924941E07B4) -ic(L4, 2.2222198607186277597E-1, -3, 1.C71C52150BEA6) -ic(L5, 1.8183562745289935658E-1, -3, 1.74663CC94342F) -ic(L6, 1.5314087275331442206E-1, -3, 1.39A1EC014045B) -ic(L7, 1.4795612545334174692E-1, -3, 1.2F039F0085122) - -#ifdef vccast -#define L1 vccast(L1) -#define L2 vccast(L2) -#define L3 vccast(L3) -#define L4 vccast(L4) -#define L5 vccast(L5) -#define L6 vccast(L6) -#define L7 vccast(L7) -#define L8 vccast(L8) -#endif - -double __log__L(z) -double z; -{ -#if defined(vax)||defined(tahoe) - return(z*(L1+z*(L2+z*(L3+z*(L4+z*(L5+z*(L6+z*(L7+z*L8)))))))); -#else /* defined(vax)||defined(tahoe) */ - return(z*(L1+z*(L2+z*(L3+z*(L4+z*(L5+z*(L6+z*L7))))))); -#endif /* defined(vax)||defined(tahoe) */ -} diff --git a/sysdeps/generic/mathimpl.h b/sysdeps/generic/mathimpl.h deleted file mode 100644 index a2c963d..0000000 --- a/sysdeps/generic/mathimpl.h +++ /dev/null @@ -1,127 +0,0 @@ -/* This part here added by roland@prep.ai.mit.edu for the GNU C library. */ - -#include /* Done first so we can #undef. */ -#include -#if __BYTE_ORDER == __LITTLE_ENDIAN -#undef national -#define national -#endif - -#undef isinf -#define isinf __isinf -#undef isnan -#define isnan __isnan -#undef infnan -#define infnan __infnan -#undef copysign -#define copysign __copysign -#undef scalb -#define scalb __scalb -#undef drem -#define drem __drem -#undef logb -#define logb __logb -#undef __finite -#undef finite -#define finite __finite -#undef expm1 -#define expm1 __expm1 - -/* - * Copyright (c) 1988, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)mathimpl.h 8.1 (Berkeley) 6/4/93 - */ - -#include -#include - -#if defined(vax)||defined(tahoe) - -/* Deal with different ways to concatenate in cpp */ -# ifdef __STDC__ -# define cat3(a,b,c) a ## b ## c -# else -# define cat3(a,b,c) a/**/b/**/c -# endif - -/* Deal with vax/tahoe byte order issues */ -# ifdef vax -# define cat3t(a,b,c) cat3(a,b,c) -# else -# define cat3t(a,b,c) cat3(a,c,b) -# endif - -# define vccast(name) (*(const double *)(cat3(name,,x))) - - /* - * Define a constant to high precision on a Vax or Tahoe. - * - * Args are the name to define, the decimal floating point value, - * four 16-bit chunks of the float value in hex - * (because the vax and tahoe differ in float format!), the power - * of 2 of the hex-float exponent, and the hex-float mantissa. - * Most of these arguments are not used at compile time; they are - * used in a post-check to make sure the constants were compiled - * correctly. - * - * People who want to use the constant will have to do their own - * #define foo vccast(foo) - * since CPP cannot do this for them from inside another macro (sigh). - * We define "vccast" if this needs doing. - */ -# define vc(name, value, x1,x2,x3,x4, bexp, xval) \ - const static long cat3(name,,x)[] = {cat3t(0x,x1,x2), cat3t(0x,x3,x4)}; - -# define ic(name, value, bexp, xval) ; - -#else /* vax or tahoe */ - - /* Hooray, we have an IEEE machine */ -# undef vccast -# define vc(name, value, x1,x2,x3,x4, bexp, xval) ; - -# define ic(name, value, bexp, xval) \ - const static double name = value; - -#endif /* defined(vax)||defined(tahoe) */ - - -/* - * Functions internal to the math package, yet not static. - */ -extern double __exp__E(); -extern double __log__L(); - -struct Double {double a, b;}; -double __exp__D __P((double, double)); -struct Double __log__D __P((double)); diff --git a/sysdeps/generic/sincos.c b/sysdeps/generic/sincos.c deleted file mode 100644 index ab88560..0000000 --- a/sysdeps/generic/sincos.c +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 1987, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -static char sccsid[] = "@(#)sincos.c 8.1 (Berkeley) 6/4/93"; -#endif /* not lint */ - -#include "trig.h" -double -sin(x) -double x; -{ - double a,c,z; - - if(!finite(x)) /* sin(NaN) and sin(INF) must be NaN */ - return x-x; - x=drem(x,PI2); /* reduce x into [-PI,PI] */ - a=copysign(x,one); - if (a >= PIo4) { - if(a >= PI3o4) /* ... in [3PI/4,PI] */ - x = copysign((a = PI-a),x); - else { /* ... in [PI/4,3PI/4] */ - a = PIo2-a; /* rtn. sign(x)*C(PI/2-|x|) */ - z = a*a; - c = cos__C(z); - z *= half; - a = (z >= thresh ? half-((z-half)-c) : one-(z-c)); - return copysign(a,x); - } - } - - if (a < small) { /* rtn. S(x) */ - big+a; - return x; - } - return x+x*sin__S(x*x); -} - -double -cos(x) -double x; -{ - double a,c,z,s = 1.0; - - if(!finite(x)) /* cos(NaN) and cos(INF) must be NaN */ - return x-x; - x=drem(x,PI2); /* reduce x into [-PI,PI] */ - a=copysign(x,one); - if (a >= PIo4) { - if (a >= PI3o4) { /* ... in [3PI/4,PI] */ - a = PI-a; - s = negone; - } - else { /* ... in [PI/4,3PI/4] */ - a = PIo2-a; - return a+a*sin__S(a*a); /* rtn. S(PI/2-|x|) */ - } - } - if (a < small) { - big+a; - return s; /* rtn. s*C(a) */ - } - z = a*a; - c = cos__C(z); - z *= half; - a = (z >= thresh ? half-((z-half)-c) : one-(z-c)); - return copysign(a,s); -} diff --git a/sysdeps/generic/trig.h b/sysdeps/generic/trig.h deleted file mode 100644 index 9e05b0e..0000000 --- a/sysdeps/generic/trig.h +++ /dev/null @@ -1,215 +0,0 @@ -/* - * Copyright (c) 1987, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)trig.h 8.1 (Berkeley) 6/4/93 - */ - -#include "mathimpl.h" - -vc(thresh, 2.6117239648121182150E-1 ,b863,3f85,6ea0,6b02, -1, .85B8636B026EA0) -vc(PIo4, 7.8539816339744830676E-1 ,0fda,4049,68c2,a221, 0, .C90FDAA22168C2) -vc(PIo2, 1.5707963267948966135E0 ,0fda,40c9,68c2,a221, 1, .C90FDAA22168C2) -vc(PI3o4, 2.3561944901923449203E0 ,cbe3,4116,0e92,f999, 2, .96CBE3F9990E92) -vc(PI, 3.1415926535897932270E0 ,0fda,4149,68c2,a221, 2, .C90FDAA22168C2) -vc(PI2, 6.2831853071795864540E0 ,0fda,41c9,68c2,a221, 3, .C90FDAA22168C2) - -ic(thresh, 2.6117239648121182150E-1 , -2, 1.0B70C6D604DD4) -ic(PIo4, 7.8539816339744827900E-1 , -1, 1.921FB54442D18) -ic(PIo2, 1.5707963267948965580E0 , 0, 1.921FB54442D18) -ic(PI3o4, 2.3561944901923448370E0 , 1, 1.2D97C7F3321D2) -ic(PI, 3.1415926535897931160E0 , 1, 1.921FB54442D18) -ic(PI2, 6.2831853071795862320E0 , 2, 1.921FB54442D18) - -#ifdef vccast -#define thresh vccast(thresh) -#define PIo4 vccast(PIo4) -#define PIo2 vccast(PIo2) -#define PI3o4 vccast(PI3o4) -#define PI vccast(PI) -#define PI2 vccast(PI2) -#endif - -#ifdef national -static long fmaxx[] = { 0xffffffff, 0x7fefffff}; -#define fmax (*(double*)fmaxx) -#endif /* national */ - -static const double - zero = 0, - one = 1, - negone = -1, - half = 1.0/2.0, - small = 1E-10, /* 1+small**2 == 1; better values for small: - * small = 1.5E-9 for VAX D - * = 1.2E-8 for IEEE Double - * = 2.8E-10 for IEEE Extended - */ - big = 1E20; /* big := 1/(small**2) */ - -/* sin__S(x*x) ... re-implemented as a macro - * DOUBLE PRECISION (VAX D format 56 bits, IEEE DOUBLE 53 BITS) - * STATIC KERNEL FUNCTION OF SIN(X), COS(X), AND TAN(X) - * CODED IN C BY K.C. NG, 1/21/85; - * REVISED BY K.C. NG on 8/13/85. - * - * sin(x*k) - x - * RETURN --------------- on [-PI/4,PI/4] , where k=pi/PI, PI is the rounded - * x - * value of pi in machine precision: - * - * Decimal: - * pi = 3.141592653589793 23846264338327 ..... - * 53 bits PI = 3.141592653589793 115997963 ..... , - * 56 bits PI = 3.141592653589793 227020265 ..... , - * - * Hexadecimal: - * pi = 3.243F6A8885A308D313198A2E.... - * 53 bits PI = 3.243F6A8885A30 = 2 * 1.921FB54442D18 - * 56 bits PI = 3.243F6A8885A308 = 4 * .C90FDAA22168C2 - * - * Method: - * 1. Let z=x*x. Create a polynomial approximation to - * (sin(k*x)-x)/x = z*(S0 + S1*z^1 + ... + S5*z^5). - * Then - * sin__S(x*x) = z*(S0 + S1*z^1 + ... + S5*z^5) - * - * The coefficient S's are obtained by a special Remez algorithm. - * - * Accuracy: - * In the absence of rounding error, the approximation has absolute error - * less than 2**(-61.11) for VAX D FORMAT, 2**(-57.45) for IEEE DOUBLE. - * - * 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. - * - */ - -vc(S0, -1.6666666666666646660E-1 ,aaaa,bf2a,aa71,aaaa, -2, -.AAAAAAAAAAAA71) -vc(S1, 8.3333333333297230413E-3 ,8888,3d08,477f,8888, -6, .8888888888477F) -vc(S2, -1.9841269838362403710E-4 ,0d00,ba50,1057,cf8a, -12, -.D00D00CF8A1057) -vc(S3, 2.7557318019967078930E-6 ,ef1c,3738,bedc,a326, -18, .B8EF1CA326BEDC) -vc(S4, -2.5051841873876551398E-8 ,3195,b3d7,e1d3,374c, -25, -.D73195374CE1D3) -vc(S5, 1.6028995389845827653E-10 ,3d9c,3030,cccc,6d26, -32, .B03D9C6D26CCCC) -vc(S6, -6.2723499671769283121E-13 ,8d0b,ac30,ea82,7561, -40, -.B08D0B7561EA82) - -ic(S0, -1.6666666666666463126E-1 , -3, -1.555555555550C) -ic(S1, 8.3333333332992771264E-3 , -7, 1.111111110C461) -ic(S2, -1.9841269816180999116E-4 , -13, -1.A01A019746345) -ic(S3, 2.7557309793219876880E-6 , -19, 1.71DE3209CDCD9) -ic(S4, -2.5050225177523807003E-8 , -26, -1.AE5C0E319A4EF) -ic(S5, 1.5868926979889205164E-10 , -33, 1.5CF61DF672B13) - -#ifdef vccast -#define S0 vccast(S0) -#define S1 vccast(S1) -#define S2 vccast(S2) -#define S3 vccast(S3) -#define S4 vccast(S4) -#define S5 vccast(S5) -#define S6 vccast(S6) -#endif - -#if defined(vax)||defined(tahoe) -# define sin__S(z) (z*(S0+z*(S1+z*(S2+z*(S3+z*(S4+z*(S5+z*S6))))))) -#else /* defined(vax)||defined(tahoe) */ -# define sin__S(z) (z*(S0+z*(S1+z*(S2+z*(S3+z*(S4+z*S5)))))) -#endif /* defined(vax)||defined(tahoe) */ - -/* cos__C(x*x) ... re-implemented as a macro - * DOUBLE PRECISION (VAX D FORMAT 56 BITS, IEEE DOUBLE 53 BITS) - * STATIC KERNEL FUNCTION OF SIN(X), COS(X), AND TAN(X) - * CODED IN C BY K.C. NG, 1/21/85; - * REVISED BY K.C. NG on 8/13/85. - * - * x*x - * RETURN cos(k*x) - 1 + ----- on [-PI/4,PI/4], where k = pi/PI, - * 2 - * PI is the rounded value of pi in machine precision : - * - * Decimal: - * pi = 3.141592653589793 23846264338327 ..... - * 53 bits PI = 3.141592653589793 115997963 ..... , - * 56 bits PI = 3.141592653589793 227020265 ..... , - * - * Hexadecimal: - * pi = 3.243F6A8885A308D313198A2E.... - * 53 bits PI = 3.243F6A8885A30 = 2 * 1.921FB54442D18 - * 56 bits PI = 3.243F6A8885A308 = 4 * .C90FDAA22168C2 - * - * - * Method: - * 1. Let z=x*x. Create a polynomial approximation to - * cos(k*x)-1+z/2 = z*z*(C0 + C1*z^1 + ... + C5*z^5) - * then - * cos__C(z) = z*z*(C0 + C1*z^1 + ... + C5*z^5) - * - * The coefficient C's are obtained by a special Remez algorithm. - * - * Accuracy: - * In the absence of rounding error, the approximation has absolute error - * less than 2**(-64) for VAX D FORMAT, 2**(-58.3) for IEEE DOUBLE. - * - * - * 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. - */ - -vc(C0, 4.1666666666666504759E-2 ,aaaa,3e2a,a9f0,aaaa, -4, .AAAAAAAAAAA9F0) -vc(C1, -1.3888888888865302059E-3 ,0b60,bbb6,0cca,b60a, -9, -.B60B60B60A0CCA) -vc(C2, 2.4801587285601038265E-5 ,0d00,38d0,098f,cdcd, -15, .D00D00CDCD098F) -vc(C3, -2.7557313470902390219E-7 ,f27b,b593,e805,b593, -21, -.93F27BB593E805) -vc(C4, 2.0875623401082232009E-9 ,74c8,320f,3ff0,fa1e, -28, .8F74C8FA1E3FF0) -vc(C5, -1.1355178117642986178E-11 ,c32d,ae47,5a63,0a5c, -36, -.C7C32D0A5C5A63) - -ic(C0, 4.1666666666666504759E-2 , -5, 1.555555555553E) -ic(C1, -1.3888888888865301516E-3 , -10, -1.6C16C16C14199) -ic(C2, 2.4801587269650015769E-5 , -16, 1.A01A01971CAEB) -ic(C3, -2.7557304623183959811E-7 , -22, -1.27E4F1314AD1A) -ic(C4, 2.0873958177697780076E-9 , -29, 1.1EE3B60DDDC8C) -ic(C5, -1.1250289076471311557E-11 , -37, -1.8BD5986B2A52E) - -#ifdef vccast -#define C0 vccast(C0) -#define C1 vccast(C1) -#define C2 vccast(C2) -#define C3 vccast(C3) -#define C4 vccast(C4) -#define C5 vccast(C5) -#endif - -#define cos__C(z) (z*z*(C0+z*(C1+z*(C2+z*(C3+z*(C4+z*C5)))))) -- cgit v1.1