From c86ab84d63b20aff7cf391414009a38477fe7137 Mon Sep 17 00:00:00 2001 From: joseph Date: Tue, 25 Oct 2011 16:50:31 +0000 Subject: Merge changes between r15532 and r15557 from /fsf/trunk. git-svn-id: svn://svn.eglibc.org/trunk@15558 7b3dc134-2b1b-0410-93df-9e9f96275f8d --- libc/sysdeps/ieee754/dbl-64/branred.c | 10 +- libc/sysdeps/ieee754/dbl-64/doasin.c | 10 +- libc/sysdeps/ieee754/dbl-64/dosincos.c | 43 +- libc/sysdeps/ieee754/dbl-64/e_asin.c | 16 +- libc/sysdeps/ieee754/dbl-64/e_atan2.c | 31 +- libc/sysdeps/ieee754/dbl-64/e_atanh.c | 7 +- libc/sysdeps/ieee754/dbl-64/e_exp.c | 14 +- libc/sysdeps/ieee754/dbl-64/e_fmod.c | 11 +- libc/sysdeps/ieee754/dbl-64/e_j0.c | 7 +- libc/sysdeps/ieee754/dbl-64/e_log.c | 12 +- libc/sysdeps/ieee754/dbl-64/e_pow.c | 28 +- libc/sysdeps/ieee754/dbl-64/halfulp.c | 10 +- libc/sysdeps/ieee754/dbl-64/mpa.c | 113 +-- libc/sysdeps/ieee754/dbl-64/mpa.h | 25 +- libc/sysdeps/ieee754/dbl-64/mpatan.c | 29 +- libc/sysdeps/ieee754/dbl-64/mpatan.h | 73 +- libc/sysdeps/ieee754/dbl-64/mpatan2.c | 15 +- libc/sysdeps/ieee754/dbl-64/mpexp.c | 43 +- libc/sysdeps/ieee754/dbl-64/mpexp.h | 70 +- libc/sysdeps/ieee754/dbl-64/mpsqrt.c | 31 +- libc/sysdeps/ieee754/dbl-64/mpsqrt.h | 29 +- libc/sysdeps/ieee754/dbl-64/mptan.c | 11 +- libc/sysdeps/ieee754/dbl-64/s_atan.c | 18 +- libc/sysdeps/ieee754/dbl-64/s_ceil.c | 34 +- libc/sysdeps/ieee754/dbl-64/s_expm1.c | 78 +- libc/sysdeps/ieee754/dbl-64/s_floor.c | 33 +- libc/sysdeps/ieee754/dbl-64/s_log1p.c | 52 +- libc/sysdeps/ieee754/dbl-64/s_round.c | 43 +- libc/sysdeps/ieee754/dbl-64/s_sin.c | 274 +++--- libc/sysdeps/ieee754/dbl-64/s_tan.c | 14 +- libc/sysdeps/ieee754/dbl-64/sincos.tbl | 912 -------------------- libc/sysdeps/ieee754/dbl-64/sincos32.c | 50 +- libc/sysdeps/ieee754/dbl-64/sincostab.c | 915 +++++++++++++++++++++ libc/sysdeps/ieee754/dbl-64/slowexp.c | 12 +- libc/sysdeps/ieee754/dbl-64/slowpow.c | 12 +- libc/sysdeps/ieee754/dbl-64/wordsize-64/e_fmod.c | 104 +++ libc/sysdeps/ieee754/dbl-64/wordsize-64/s_ceil.c | 16 +- libc/sysdeps/ieee754/dbl-64/wordsize-64/s_floor.c | 16 +- libc/sysdeps/ieee754/dbl-64/wordsize-64/s_remquo.c | 112 +++ libc/sysdeps/ieee754/dbl-64/wordsize-64/s_round.c | 24 +- 40 files changed, 1891 insertions(+), 1466 deletions(-) delete mode 100644 libc/sysdeps/ieee754/dbl-64/sincos.tbl create mode 100644 libc/sysdeps/ieee754/dbl-64/sincostab.c create mode 100644 libc/sysdeps/ieee754/dbl-64/wordsize-64/e_fmod.c create mode 100644 libc/sysdeps/ieee754/dbl-64/wordsize-64/s_remquo.c (limited to 'libc/sysdeps/ieee754/dbl-64') diff --git a/libc/sysdeps/ieee754/dbl-64/branred.c b/libc/sysdeps/ieee754/dbl-64/branred.c index 76015f0c5..c8483034a 100644 --- a/libc/sysdeps/ieee754/dbl-64/branred.c +++ b/libc/sysdeps/ieee754/dbl-64/branred.c @@ -1,7 +1,7 @@ /* * IBM Accurate Mathematical Library * Written by International Business Machines Corp. - * Copyright (C) 2001 Free Software Foundation, Inc. + * Copyright (C) 2001, 2011 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -38,6 +38,10 @@ #include "branred.h" #include "math_private.h" +#ifndef SECTION +# define SECTION +#endif + /*******************************************************************/ /* Routine branred() performs range reduction of a double number */ @@ -45,7 +49,9 @@ /* x=n*pi/2+(a+aa), abs(a+aa) #include "math_private.h" +#ifndef SECTION +# define SECTION +#endif + /********************************************************************/ /* Compute arcsin(x,dx,v) of double-length number (x+dx) the result */ /* stored in v where v= v[0]+v[1] =arcsin(x+dx) */ /********************************************************************/ -void __doasin(double x, double dx, double v[]) { +void +SECTION +__doasin(double x, double dx, double v[]) { #include "doasin.h" @@ -53,7 +59,7 @@ void __doasin(double x, double dx, double v[]) { double xx,p,pp,u,uu,r,s; double tc,tcc; -#ifndef DLA_FMA +#ifndef DLA_FMS double hx,tx,hy,ty,tp,tq; #endif diff --git a/libc/sysdeps/ieee754/dbl-64/dosincos.c b/libc/sysdeps/ieee754/dbl-64/dosincos.c index 4ae88c31c..e8890ff8d 100644 --- a/libc/sysdeps/ieee754/dbl-64/dosincos.c +++ b/libc/sysdeps/ieee754/dbl-64/dosincos.c @@ -35,11 +35,20 @@ #include "endian.h" #include "mydefs.h" -#include "sincos.tbl" #include #include "dosincos.h" #include "math_private.h" +#ifndef SECTION +# define SECTION +#endif + +extern const union +{ + int4 i[880]; + double x[440]; +} __sincostab attribute_hidden; + /***********************************************************************/ /* Routine receive Double-Length number (x+dx) and computing sin(x+dx) */ /* as Double-Length number and store it at array v .It computes it by */ @@ -47,10 +56,12 @@ /*(x+dx) between 0 and PI/4 */ /***********************************************************************/ -void __dubsin(double x, double dx, double v[]) { +void +SECTION +__dubsin(double x, double dx, double v[]) { double r,s,c,cc,d,dd,d2,dd2,e,ee, sn,ssn,cs,ccs,ds,dss,dc,dcc; -#ifndef DLA_FMA +#ifndef DLA_FMS double p,hx,tx,hy,ty,q; #endif #if 0 @@ -66,10 +77,10 @@ void __dubsin(double x, double dx, double v[]) { dd=(x-d)+dx; /* sin(x+dx)=sin(Xi+t)=sin(Xi)*cos(t) + cos(Xi)sin(t) where t ->0 */ MUL2(d,dd,d,dd,d2,dd2,p,hx,tx,hy,ty,q,c,cc); - sn=sincos.x[k]; /* */ - ssn=sincos.x[k+1]; /* sin(Xi) and cos(Xi) */ - cs=sincos.x[k+2]; /* */ - ccs=sincos.x[k+3]; /* */ + sn=__sincostab.x[k]; /* */ + ssn=__sincostab.x[k+1]; /* sin(Xi) and cos(Xi) */ + cs=__sincostab.x[k+2]; /* */ + ccs=__sincostab.x[k+3]; /* */ MUL2(d2,dd2,s7.x,ss7.x,ds,dss,p,hx,tx,hy,ty,q,c,cc); /* Taylor */ ADD2(ds,dss,s5.x,ss5.x,ds,dss,r,s); MUL2(d2,dd2,ds,dss,ds,dss,p,hx,tx,hy,ty,q,c,cc); /* series */ @@ -101,10 +112,12 @@ void __dubsin(double x, double dx, double v[]) { /*(x+dx) between 0 and PI/4 */ /**********************************************************************/ -void __dubcos(double x, double dx, double v[]) { +void +SECTION +__dubcos(double x, double dx, double v[]) { double r,s,c,cc,d,dd,d2,dd2,e,ee, sn,ssn,cs,ccs,ds,dss,dc,dcc; -#ifndef DLA_FMA +#ifndef DLA_FMS double p,hx,tx,hy,ty,q; #endif #if 0 @@ -118,10 +131,10 @@ void __dubcos(double x, double dx, double v[]) { d=x+dx; dd=(x-d)+dx; /* cos(x+dx)=cos(Xi+t)=cos(Xi)cos(t) - sin(Xi)sin(t) */ MUL2(d,dd,d,dd,d2,dd2,p,hx,tx,hy,ty,q,c,cc); - sn=sincos.x[k]; /* */ - ssn=sincos.x[k+1]; /* sin(Xi) and cos(Xi) */ - cs=sincos.x[k+2]; /* */ - ccs=sincos.x[k+3]; /* */ + sn=__sincostab.x[k]; /* */ + ssn=__sincostab.x[k+1]; /* sin(Xi) and cos(Xi) */ + cs=__sincostab.x[k+2]; /* */ + ccs=__sincostab.x[k+3]; /* */ MUL2(d2,dd2,s7.x,ss7.x,ds,dss,p,hx,tx,hy,ty,q,c,cc); ADD2(ds,dss,s5.x,ss5.x,ds,dss,r,s); MUL2(d2,dd2,ds,dss,ds,dss,p,hx,tx,hy,ty,q,c,cc); @@ -167,7 +180,9 @@ void __dubcos(double x, double dx, double v[]) { /* Routine receive Double-Length number (x+dx) and computes cos(x+dx) */ /* as Double-Length number and store it in array v */ /**********************************************************************/ -void __docos(double x, double dx, double v[]) { +void +SECTION +__docos(double x, double dx, double v[]) { double y,yy,p,w[2]; if (x>0) {y=x; yy=dx;} else {y=-x; yy=-dx;} diff --git a/libc/sysdeps/ieee754/dbl-64/e_asin.c b/libc/sysdeps/ieee754/dbl-64/e_asin.c index 02efb7ad2..65319c0b5 100644 --- a/libc/sysdeps/ieee754/dbl-64/e_asin.c +++ b/libc/sysdeps/ieee754/dbl-64/e_asin.c @@ -42,6 +42,10 @@ #include "uasncs.h" #include "math_private.h" +#ifndef SECTION +# define SECTION +#endif + void __doasin(double x, double dx, double w[]); void __dubsin(double x, double dx, double v[]); void __dubcos(double x, double dx, double v[]); @@ -53,7 +57,9 @@ double __cos32(double x, double res, double res1); /* An ultimate asin routine. Given an IEEE double machine number x */ /* it computes the correctly rounded (to nearest) value of arcsin(x) */ /***************************************************************************/ -double __ieee754_asin(double x){ +double +SECTION +__ieee754_asin(double x){ double x1,x2,xx,s1,s2,res1,p,t,res,r,cor,cc,y,c,z,w[2]; mynumber u,v; int4 k,m,n; @@ -324,7 +330,9 @@ double __ieee754_asin(double x){ return u.x/v.x; /* NaN */ } } +#ifndef __ieee754_asin strong_alias (__ieee754_asin, __asin_finite) +#endif /*******************************************************************/ /* */ @@ -332,7 +340,9 @@ strong_alias (__ieee754_asin, __asin_finite) /* */ /*******************************************************************/ -double __ieee754_acos(double x) +double +SECTION +__ieee754_acos(double x) { double x1,x2,xx,s1,s2,res1,p,t,res,r,cor,cc,y,c,z,w[2],eps; #if 0 @@ -636,4 +646,6 @@ double __ieee754_acos(double x) return u.x/v.x; } } +#ifndef __ieee754_acos strong_alias (__ieee754_acos, __acos_finite) +#endif diff --git a/libc/sysdeps/ieee754/dbl-64/e_atan2.c b/libc/sysdeps/ieee754/dbl-64/e_atan2.c index f8f678bc5..64dae3e8d 100644 --- a/libc/sysdeps/ieee754/dbl-64/e_atan2.c +++ b/libc/sysdeps/ieee754/dbl-64/e_atan2.c @@ -44,6 +44,10 @@ #include "atnat2.h" #include "math_private.h" +#ifndef SECTION +# define SECTION +#endif + /************************************************************************/ /* An ultimate atan2 routine. Given two IEEE double machine numbers y,x */ /* it computes the correctly rounded (to nearest) value of atan2(y,x). */ @@ -51,11 +55,17 @@ /* round to nearest mode of IEEE 754 standard. */ /************************************************************************/ static double atan2Mp(double ,double ,const int[]); -static double signArctan2(double ,double); + /* Fix the sign and return after stage 1 or stage 2 */ +static double signArctan2(double y,double z) +{ + return __copysign(z, y); +} static double normalized(double ,double,double ,double); void __mpatan2(mp_no *,mp_no *,mp_no *,int); -double __ieee754_atan2(double y,double x) { +double +SECTION +__ieee754_atan2(double y,double x) { int i,de,ux,dx,uy,dy; #if 0 @@ -64,7 +74,7 @@ double __ieee754_atan2(double y,double x) { static const int pr[MM]={6,8,10,20,32}; double ax,ay,u,du,u9,ua,v,vv,dv,t1,t2,t3,t7,t8, z,zz,cor,s1,ss1,s2,ss2; -#ifndef DLA_FMA +#ifndef DLA_FMS double t4,t5,t6; #endif #if 0 @@ -375,10 +385,14 @@ double __ieee754_atan2(double y,double x) { } } } +#ifndef __ieee754_atan2 strong_alias (__ieee754_atan2, __atan2_finite) +#endif /* Treat the Denormalized case */ -static double normalized(double ax,double ay,double y, double z) +static double +SECTION +normalized(double ax,double ay,double y, double z) { int p; mp_no mpx,mpy,mpz,mperr,mpz2,mpt1; p=6; @@ -386,14 +400,11 @@ static double normalized(double ax,double ay,double y, double z) __dbl_mp(ue.d,&mpt1,p); __mul(&mpz,&mpt1,&mperr,p); __sub(&mpz,&mperr,&mpz2,p); __mp_dbl(&mpz2,&z,p); return signArctan2(y,z); -} - /* Fix the sign and return after stage 1 or stage 2 */ -static double signArctan2(double y,double z) -{ - return ((y 0.0) - return x; + if (__builtin_expect (xa < 0x1.0p-28, 0)) + { + math_force_eval (huge + x); + return x; + } t = xa + xa; t = 0.5 * __log1p (t + t * xa / (1.0 - xa)); diff --git a/libc/sysdeps/ieee754/dbl-64/e_exp.c b/libc/sysdeps/ieee754/dbl-64/e_exp.c index f4b34a636..e7a839d42 100644 --- a/libc/sysdeps/ieee754/dbl-64/e_exp.c +++ b/libc/sysdeps/ieee754/dbl-64/e_exp.c @@ -40,13 +40,19 @@ #include "uexp.tbl" #include "math_private.h" +#ifndef SECTION +# define SECTION +#endif + double __slowexp(double); /***************************************************************************/ /* An ultimate exp routine. Given an IEEE double machine number x */ /* it computes the correctly rounded (to nearest) value of e^x */ /***************************************************************************/ -double __ieee754_exp(double x) { +double +SECTION +__ieee754_exp(double x) { double bexp, t, eps, del, base, y, al, bet, res, rem, cor; mynumber junk1, junk2, binexp = {{0,0}}; #if 0 @@ -145,7 +151,9 @@ double __ieee754_exp(double x) { else return __slowexp(x); } } +#ifndef __ieee754_exp strong_alias (__ieee754_exp, __exp_finite) +#endif /************************************************************************/ /* Compute e^(x+xx)(Double-Length number) .The routine also receive */ @@ -154,7 +162,9 @@ strong_alias (__ieee754_exp, __exp_finite) /*else return e^(x + xx) (always positive ) */ /************************************************************************/ -double __exp1(double x, double xx, double error) { +double +SECTION +__exp1(double x, double xx, double error) { double bexp, t, eps, del, base, y, al, bet, res, rem, cor; mynumber junk1, junk2, binexp = {{0,0}}; #if 0 diff --git a/libc/sysdeps/ieee754/dbl-64/e_fmod.c b/libc/sysdeps/ieee754/dbl-64/e_fmod.c index a575f616b..0328b011d 100644 --- a/libc/sysdeps/ieee754/dbl-64/e_fmod.c +++ b/libc/sysdeps/ieee754/dbl-64/e_fmod.c @@ -1,4 +1,3 @@ -/* @(#)e_fmod.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -44,7 +43,7 @@ __ieee754_fmod (double x, double y) } /* determine ix = ilogb(x) */ - if(hx<0x00100000) { /* subnormal x */ + if(__builtin_expect(hx<0x00100000, 0)) { /* subnormal x */ if(hx==0) { for (ix = -1043, i=lx; i>0; i<<=1) ix -=1; } else { @@ -53,7 +52,7 @@ __ieee754_fmod (double x, double y) } else ix = (hx>>20)-1023; /* determine iy = ilogb(y) */ - if(hy<0x00100000) { /* subnormal y */ + if(__builtin_expect(hy<0x00100000, 0)) { /* subnormal y */ if(hy==0) { for (iy = -1043, i=ly; i>0; i<<=1) iy -=1; } else { @@ -62,7 +61,7 @@ __ieee754_fmod (double x, double y) } else iy = (hy>>20)-1023; /* set up {hx,lx}, {hy,ly} and align y to x */ - if(ix >= -1022) + if(__builtin_expect(ix >= -1022, 1)) hx = 0x00100000|(0x000fffff&hx); else { /* subnormal x, shift x to normal */ n = -1022-ix; @@ -74,7 +73,7 @@ __ieee754_fmod (double x, double y) lx = 0; } } - if(iy >= -1022) + if(__builtin_expect(iy >= -1022, 1)) hy = 0x00100000|(0x000fffff&hy); else { /* subnormal y, shift y to normal */ n = -1022-iy; @@ -108,7 +107,7 @@ __ieee754_fmod (double x, double y) hx = hx+hx+(lx>>31); lx = lx+lx; iy -= 1; } - if(iy>= -1022) { /* normalize output */ + if(__builtin_expect(iy>= -1022, 1)) { /* normalize output */ hx = ((hx-0x00100000)|((iy+1023)<<20)); INSERT_WORDS(x,hx|sx,lx); } else { /* subnormal output */ diff --git a/libc/sysdeps/ieee754/dbl-64/e_j0.c b/libc/sysdeps/ieee754/dbl-64/e_j0.c index 5ebf2056b..48584a60b 100644 --- a/libc/sysdeps/ieee754/dbl-64/e_j0.c +++ b/libc/sysdeps/ieee754/dbl-64/e_j0.c @@ -111,10 +111,9 @@ __ieee754_j0(double x) return z; } if(ix<0x3f200000) { /* |x| < 2**-13 */ - if(huge+x>one) { /* raise inexact if x != 0 */ - if(ix<0x3e400000) return one; /* |x|<2**-27 */ - else return one - 0.25*x*x; - } + math_force_eval(huge+x); /* raise inexact if x != 0 */ + if(ix<0x3e400000) return one; /* |x|<2**-27 */ + else return one - 0.25*x*x; } z = x*x; #ifdef DO_NOT_USE_THIS diff --git a/libc/sysdeps/ieee754/dbl-64/e_log.c b/libc/sysdeps/ieee754/dbl-64/e_log.c index 14851638a..e45520eba 100644 --- a/libc/sysdeps/ieee754/dbl-64/e_log.c +++ b/libc/sysdeps/ieee754/dbl-64/e_log.c @@ -41,13 +41,19 @@ #include "MathLib.h" #include "math_private.h" +#ifndef SECTION +# define SECTION +#endif + void __mplog(mp_no *, mp_no *, int); /*********************************************************************/ /* An ultimate log routine. Given an IEEE double machine number x */ /* it computes the correctly rounded (to nearest) value of log(x). */ /*********************************************************************/ -double __ieee754_log(double x) { +double +SECTION +__ieee754_log(double x) { #define M 4 static const int pr[M]={8,10,18,32}; int i,j,n,ux,dx,p; @@ -58,7 +64,7 @@ double __ieee754_log(double x) { sij,ssij,ttij,A,B,B0,y,y1,y2,polI,polII,sa,sb, t1,t2,t7,t8,t,ra,rb,ww, a0,aa0,s1,s2,ss2,s3,ss3,a1,aa1,a,aa,b,bb,c; -#ifndef DLA_FMA +#ifndef DLA_FMS double t3,t4,t5,t6; #endif number num; @@ -207,4 +213,6 @@ double __ieee754_log(double x) { } return y1; } +#ifndef __ieee754_log strong_alias (__ieee754_log, __log_finite) +#endif diff --git a/libc/sysdeps/ieee754/dbl-64/e_pow.c b/libc/sysdeps/ieee754/dbl-64/e_pow.c index 789054015..350e93986 100644 --- a/libc/sysdeps/ieee754/dbl-64/e_pow.c +++ b/libc/sysdeps/ieee754/dbl-64/e_pow.c @@ -43,6 +43,10 @@ #include "upow.tbl" #include "math_private.h" +#ifndef SECTION +# define SECTION +#endif + double __exp1(double x, double xx, double error); static double log1(double x, double *delta, double *error); @@ -55,7 +59,9 @@ static int checkint(double x); /* An ultimate power routine. Given two IEEE double machine numbers y,x */ /* it computes the correctly rounded (to nearest) value of X^y. */ /***************************************************************************/ -double __ieee754_pow(double x, double y) { +double +SECTION +__ieee754_pow(double x, double y) { double z,a,aa,error, t,a1,a2,y1,y2; #if 0 double gor=1.0; @@ -153,12 +159,16 @@ double __ieee754_pow(double x, double y) { if (y<0) return (x<1.0)?INF.x:0; return 0; /* unreachable, to make the compiler happy */ } +#ifndef __ieee754_pow strong_alias (__ieee754_pow, __pow_finite) +#endif /**************************************************************************/ /* Computing x^y using more accurate but more slow log routine */ /**************************************************************************/ -static double power1(double x, double y) { +static double +SECTION +power1(double x, double y) { double z,a,aa,error, t,a1,a2,y1,y2; z = my_log2(x,&aa,&error); t = y*134217729.0; @@ -181,7 +191,9 @@ static double power1(double x, double y) { /* + the parameter delta. */ /* The result is bounded by error (rightmost argument) */ /****************************************************************************/ -static double log1(double x, double *delta, double *error) { +static double +SECTION +log1(double x, double *delta, double *error) { int i,j,m; #if 0 int n; @@ -273,7 +285,9 @@ static double log1(double x, double *delta, double *error) { /* Computing log(x)(x is left argument).The result is return double + delta.*/ /* The result is bounded by error (right argument) */ /****************************************************************************/ -static double my_log2(double x, double *delta, double *error) { +static double +SECTION +my_log2(double x, double *delta, double *error) { int i,j,m; #if 0 int n; @@ -284,7 +298,7 @@ static double my_log2(double x, double *delta, double *error) { #endif double ou1,ou2,lu1,lu2,ov,lv1,lv2,a,a1,a2; double y,yy,z,zz,j1,j2,j7,j8; -#ifndef DLA_FMA +#ifndef DLA_FMS double j3,j4,j5,j6; #endif mynumber u,v; @@ -367,7 +381,9 @@ static double my_log2(double x, double *delta, double *error) { /* Routine receives a double x and checks if it is an integer. If not */ /* it returns 0, else it returns 1 if even or -1 if odd. */ /**********************************************************************/ -static int checkint(double x) { +static int +SECTION +checkint(double x) { union {int4 i[2]; double x;} u; int k,m,n; #if 0 diff --git a/libc/sysdeps/ieee754/dbl-64/halfulp.c b/libc/sysdeps/ieee754/dbl-64/halfulp.c index 373d40522..601830942 100644 --- a/libc/sysdeps/ieee754/dbl-64/halfulp.c +++ b/libc/sysdeps/ieee754/dbl-64/halfulp.c @@ -40,6 +40,10 @@ #include #include "math_private.h" +#ifndef SECTION +# define SECTION +#endif + static const int4 tab54[32] = { 262143, 11585, 1782, 511, 210, 107, 63, 42, 30, 22, 17, 14, 12, 10, 9, 7, @@ -47,11 +51,13 @@ static const int4 tab54[32] = { 3, 3, 3, 3, 3, 3, 3, 3 }; -double __halfulp(double x, double y) +double +SECTION +__halfulp(double x, double y) { mynumber v; double z,u,uu; -#ifndef DLA_FMA +#ifndef DLA_FMS double j1,j2,j3,j4,j5; #endif int4 k,l,m,n; diff --git a/libc/sysdeps/ieee754/dbl-64/mpa.c b/libc/sysdeps/ieee754/dbl-64/mpa.c index 68647ba33..39c640882 100644 --- a/libc/sysdeps/ieee754/dbl-64/mpa.c +++ b/libc/sysdeps/ieee754/dbl-64/mpa.c @@ -1,8 +1,7 @@ - /* * IBM Accurate Mathematical Library * written by International Business Machines Corp. - * Copyright (C) 2001 Free Software Foundation + * Copyright (C) 2001, 2011 Free Software Foundation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -48,11 +47,18 @@ #include "mpa.h" #include "mpa2.h" #include /* For MIN() */ + +#ifndef SECTION +# define SECTION +#endif + +#ifndef NO___ACR /* mcr() compares the sizes of the mantissas of two multiple precision */ /* numbers. Mantissas are compared regardless of the signs of the */ /* numbers, even if x->d[0] or y->d[0] are zero. Exponents are also */ /* disregarded. */ -static int mcr(const mp_no *x, const mp_no *y, int p) { +static int +mcr(const mp_no *x, const mp_no *y, int p) { int i; for (i=1; i<=p; i++) { if (X[i] == Y[i]) continue; @@ -62,9 +68,9 @@ static int mcr(const mp_no *x, const mp_no *y, int p) { } - /* acr() compares the absolute values of two multiple precision numbers */ -int __acr(const mp_no *x, const mp_no *y, int p) { +int +__acr(const mp_no *x, const mp_no *y, int p) { int i; if (X[0] == ZERO) { @@ -80,10 +86,12 @@ int __acr(const mp_no *x, const mp_no *y, int p) { return i; } +#endif -/* cr90 compares the values of two multiple precision numbers */ -int __cr(const mp_no *x, const mp_no *y, int p) { +#if 0 +/* cr() compares the values of two multiple precision numbers */ +static int __cr(const mp_no *x, const mp_no *y, int p) { int i; if (X[0] > Y[0]) i= 1; @@ -93,36 +101,37 @@ int __cr(const mp_no *x, const mp_no *y, int p) { return i; } +#endif +#ifndef NO___CPY /* Copy a multiple precision number. Set *y=*x. x=y is permissible. */ void __cpy(const mp_no *x, mp_no *y, int p) { - int i; - EY = EX; - for (i=0; i <= p; i++) Y[i] = X[i]; - - return; + for (int i=0; i <= p; i++) Y[i] = X[i]; } +#endif +#if 0 /* Copy a multiple precision number x of precision m into a */ /* multiple precision number y of precision n. In case n>m, */ /* the digits of y beyond the m'th are set to zero. In case */ /* n= 2**(-1022))) */ static void norm(const mp_no *x, double *y, int p) @@ -141,7 +150,7 @@ static void norm(const mp_no *x, double *y, int p) } else { for (a=ONE, z[1]=X[1]; z[1] < TWO23; ) - {a *= TWO; z[1] *= TWO; } + {a *= TWO; z[1] *= TWO; } for (i=2; i<5; i++) { z[i] = X[i]*a; @@ -157,10 +166,10 @@ static void norm(const mp_no *x, double *y, int p) if (v == TWO18) { if (z[4] == ZERO) { - for (i=5; i <= p; i++) { - if (X[i] == ZERO) continue; - else {z[3] += ONE; break; } - } + for (i=5; i <= p; i++) { + if (X[i] == ZERO) continue; + else {z[3] += ONE; break; } + } } else z[3] += ONE; } @@ -174,7 +183,6 @@ static void norm(const mp_no *x, double *y, int p) for (i=1; i>EX; i--) c *= RADIXI; *y = c; - return; #undef R } @@ -222,8 +230,6 @@ static void denorm(const mp_no *x, double *y, int p) c = X[0]*((z[1] + R*(z[2] + R*z[3])) - TWO10); *y = c*TWOM1032; - return; - #undef R } @@ -242,13 +248,16 @@ void __mp_dbl(const mp_no *x, double *y, int p) { else if (EX==-42 && X[1]>=TWO10) norm(x,y,p); else denorm(x,y,p); } +#endif /* dbl_mp() converts a double precision number x into a multiple precision */ /* number *y. If the precision p is too small the result is truncated. x is */ /* left unchanged. */ -void __dbl_mp(double x, mp_no *y, int p) { +void +SECTION +__dbl_mp(double x, mp_no *y, int p) { int i,n; double u; @@ -269,7 +278,6 @@ void __dbl_mp(double x, mp_no *y, int p) { if (u>x) u -= ONE; Y[i] = u; x -= u; x *= RADIX; } for ( ; i<=p; i++) Y[i] = ZERO; - return; } @@ -279,7 +287,9 @@ void __dbl_mp(double x, mp_no *y, int p) { /* No guard digit is used. The result equals the exact sum, truncated. */ /* *x & *y are left unchanged. */ -static void add_magnitudes(const mp_no *x, const mp_no *y, mp_no *z, int p) { +static void +SECTION +add_magnitudes(const mp_no *x, const mp_no *y, mp_no *z, int p) { int i,j,k; @@ -321,7 +331,9 @@ static void add_magnitudes(const mp_no *x, const mp_no *y, mp_no *z, int p) { /* or y&z. One guard digit is used. The error is less than one ulp. */ /* *x & *y are left unchanged. */ -static void sub_magnitudes(const mp_no *x, const mp_no *y, mp_no *z, int p) { +static void +SECTION +sub_magnitudes(const mp_no *x, const mp_no *y, mp_no *z, int p) { int i,j,k; @@ -336,11 +348,11 @@ static void sub_magnitudes(const mp_no *x, const mp_no *y, mp_no *z, int p) { else { i=p; j=p+1-j; k=p; if (Y[j] > ZERO) { - Z[k+1] = RADIX - Y[j--]; - Z[k] = MONE; } + Z[k+1] = RADIX - Y[j--]; + Z[k] = MONE; } else { - Z[k+1] = ZERO; - Z[k] = ZERO; j--;} + Z[k+1] = ZERO; + Z[k] = ZERO; j--;} } } @@ -368,8 +380,6 @@ static void sub_magnitudes(const mp_no *x, const mp_no *y, mp_no *z, int p) { Z[k++] = Z[i++]; for (; k <= p; ) Z[k++] = ZERO; - - return; } @@ -377,7 +387,9 @@ static void sub_magnitudes(const mp_no *x, const mp_no *y, mp_no *z, int p) { /* but not x&z or y&z. One guard digit is used. The error is less than */ /* one ulp. *x & *y are left unchanged. */ -void __add(const mp_no *x, const mp_no *y, mp_no *z, int p) { +void +SECTION +__add(const mp_no *x, const mp_no *y, mp_no *z, int p) { int n; @@ -393,7 +405,6 @@ void __add(const mp_no *x, const mp_no *y, mp_no *z, int p) { else if (n == -1) {sub_magnitudes(y,x,z,p); Z[0] = Y[0]; } else Z[0] = ZERO; } - return; } @@ -401,7 +412,9 @@ void __add(const mp_no *x, const mp_no *y, mp_no *z, int p) { /* overlap but not x&z or y&z. One guard digit is used. The error is */ /* less than one ulp. *x & *y are left unchanged. */ -void __sub(const mp_no *x, const mp_no *y, mp_no *z, int p) { +void +SECTION +__sub(const mp_no *x, const mp_no *y, mp_no *z, int p) { int n; @@ -417,7 +430,6 @@ void __sub(const mp_no *x, const mp_no *y, mp_no *z, int p) { else if (n == -1) {sub_magnitudes(y,x,z,p); Z[0] = -Y[0]; } else Z[0] = ZERO; } - return; } @@ -426,16 +438,18 @@ void __sub(const mp_no *x, const mp_no *y, mp_no *z, int p) { /* truncated to p digits. In case p>3 the error is bounded by 1.001 ulp. */ /* *x & *y are left unchanged. */ -void __mul(const mp_no *x, const mp_no *y, mp_no *z, int p) { +void +SECTION +__mul(const mp_no *x, const mp_no *y, mp_no *z, int p) { int i, i1, i2, j, k, k2; double u; - /* Is z=0? */ + /* Is z=0? */ if (X[0]*Y[0]==ZERO) { Z[0]=ZERO; return; } - /* Multiply, add and carry */ + /* Multiply, add and carry */ k2 = (p<3) ? p+p : p+3; Z[k2]=ZERO; for (k=k2; k>1; ) { @@ -449,7 +463,7 @@ void __mul(const mp_no *x, const mp_no *y, mp_no *z, int p) { Z[--k] = u*RADIXI; } - /* Is there a carry beyond the most significant digit? */ + /* Is there a carry beyond the most significant digit? */ if (Z[1] == ZERO) { for (i=1; i<=p; i++) Z[i]=Z[i+1]; EZ = EX + EY - 1; } @@ -457,7 +471,6 @@ void __mul(const mp_no *x, const mp_no *y, mp_no *z, int p) { EZ = EX + EY; Z[0] = X[0] * Y[0]; - return; } @@ -466,6 +479,8 @@ void __mul(const mp_no *x, const mp_no *y, mp_no *z, int p) { /* 2.001*r**(1-p) for p>3. */ /* *x=0 is not permissible. *x is left unchanged. */ +static +SECTION void __inv(const mp_no *x, mp_no *y, int p) { int i; #if 0 @@ -474,11 +489,11 @@ void __inv(const mp_no *x, mp_no *y, int p) { double t; mp_no z,w; static const int np1[] = {0,0,0,0,1,2,2,2,2,3,3,3,3,3,3,3,3,3, - 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4}; + 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4}; const mp_no mptwo = {1,{1.0,2.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0, - 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0, - 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0, - 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0}}; + 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0, + 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0, + 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0}}; __cpy(x,&z,p); z.e=0; __mp_dbl(&z,&t,p); t=ONE/t; __dbl_mp(t,y,p); EY -= EX; @@ -489,7 +504,6 @@ void __inv(const mp_no *x, mp_no *y, int p) { __sub(&mptwo,y,&z,p); __mul(&w,&z,y,p); } - return; } @@ -498,11 +512,12 @@ void __inv(const mp_no *x, mp_no *y, int p) { /* Relative error bound = 2.001*r**(1-p) for p=2, 2.063*r**(1-p) for p=3 */ /* and 3.001*r**(1-p) for p>3. *y=0 is not permissible. */ -void __dvd(const mp_no *x, const mp_no *y, mp_no *z, int p) { +void +SECTION +__dvd(const mp_no *x, const mp_no *y, mp_no *z, int p) { mp_no w; if (X[0] == ZERO) Z[0] = ZERO; else {__inv(y,&w,p); __mul(x,&w,z,p);} - return; } diff --git a/libc/sysdeps/ieee754/dbl-64/mpa.h b/libc/sysdeps/ieee754/dbl-64/mpa.h index 4aec48e90..5647ab7b4 100644 --- a/libc/sysdeps/ieee754/dbl-64/mpa.h +++ b/libc/sysdeps/ieee754/dbl-64/mpa.h @@ -1,8 +1,7 @@ - /* * IBM Accurate Mathematical Library * Written by International Business Machines Corp. - * Copyright (C) 2001 Free Software Foundation, Inc. + * Copyright (C) 2001, 2011 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -45,14 +44,14 @@ typedef struct {/* This structure holds the details of a multi-precision */ int e; /* floating point number, x: d[0] holds its sign (-1,0 or 1) */ double d[40]; /* e holds its exponent (...,-2,-1,0,1,2,...) and */ } mp_no; /* d[1]...d[p] hold its mantissa digits. The value of x is, */ - /* x = d[1]*r**(e-1) + d[2]*r**(e-2) + ... + d[p]*r**(e-p). */ - /* Here r = 2**24, 0 <= d[i] < r and 1 <= p <= 32. */ - /* p is a global variable. A multi-precision number is */ - /* always normalized. Namely, d[1] > 0. An exception is */ - /* a zero which is characterized by d[0] = 0. The terms */ - /* d[p+1], d[p+2], ... of a none zero number have no */ - /* significance and so are the terms e, d[1],d[2],... */ - /* of a zero. */ + /* x = d[1]*r**(e-1) + d[2]*r**(e-2) + ... + d[p]*r**(e-p). */ + /* Here r = 2**24, 0 <= d[i] < r and 1 <= p <= 32. */ + /* p is a global variable. A multi-precision number is */ + /* always normalized. Namely, d[1] > 0. An exception is */ + /* a zero which is characterized by d[0] = 0. The terms */ + /* d[p+1], d[p+2], ... of a none zero number have no */ + /* significance and so are the terms e, d[1],d[2],... */ + /* of a zero. */ typedef union { int i[2]; double d; } number; @@ -66,15 +65,15 @@ typedef union { int i[2]; double d; } number; #define ABS(x) ((x) < 0 ? -(x) : (x)) int __acr(const mp_no *, const mp_no *, int); -int __cr(const mp_no *, const mp_no *, int); +// int __cr(const mp_no *, const mp_no *, int); void __cpy(const mp_no *, mp_no *, int); -void __cpymn(const mp_no *, int, mp_no *, int); +// void __cpymn(const mp_no *, int, mp_no *, int); void __mp_dbl(const mp_no *, double *, int); void __dbl_mp(double, mp_no *, int); void __add(const mp_no *, const mp_no *, mp_no *, int); void __sub(const mp_no *, const mp_no *, mp_no *, int); void __mul(const mp_no *, const mp_no *, mp_no *, int); -void __inv(const mp_no *, mp_no *, int); +// void __inv(const mp_no *, mp_no *, int); void __dvd(const mp_no *, const mp_no *, mp_no *, int); extern void __mpatan (mp_no *, mp_no *, int); diff --git a/libc/sysdeps/ieee754/dbl-64/mpatan.c b/libc/sysdeps/ieee754/dbl-64/mpatan.c index ee21c2513..f40873ea5 100644 --- a/libc/sysdeps/ieee754/dbl-64/mpatan.c +++ b/libc/sysdeps/ieee754/dbl-64/mpatan.c @@ -1,8 +1,7 @@ - /* * IBM Accurate Mathematical Library * written by International Business Machines Corp. - * Copyright (C) 2001 Free Software Foundation + * Copyright (C) 2001, 2011 Free Software Foundation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -34,11 +33,19 @@ #include "endian.h" #include "mpa.h" -void __mpsqrt(mp_no *, mp_no *, int); -void __mpatan(mp_no *x, mp_no *y, int p) { +#ifndef SECTION +# define SECTION +#endif + #include "mpatan.h" +void __mpsqrt(mp_no *, mp_no *, int); + +void +SECTION +__mpatan(mp_no *x, mp_no *y, int p) { + int i,m,n; double dx; mp_no @@ -54,19 +61,19 @@ void __mpatan(mp_no *x, mp_no *y, int p) { mp_no mps,mpsm,mpt,mpt1,mpt2,mpt3; - /* Choose m and initiate mpone, mptwo & mptwoim1 */ + /* Choose m and initiate mpone, mptwo & mptwoim1 */ if (EX>0) m=7; else if (EX<0) m=0; else { __mp_dbl(x,&dx,p); dx=ABS(dx); for (m=6; m>0; m--) - {if (dx>xm[m].d) break;} + {if (dx>__atan_xm[m].d) break;} } mpone.e = mptwo.e = mptwoim1.e = 1; mpone.d[0] = mpone.d[1] = mptwo.d[0] = mptwoim1.d[0] = ONE; mptwo.d[1] = TWO; - /* Reduce x m times */ + /* Reduce x m times */ __mul(x,x,&mpsm,p); if (m==0) __cpy(x,&mps,p); else { @@ -82,8 +89,8 @@ void __mpatan(mp_no *x, mp_no *y, int p) { __mpsqrt(&mpsm,&mps,p); mps.d[0] = X[0]; } - /* Evaluate a truncated power series for Atan(s) */ - n=np[p]; mptwoim1.d[1] = twonm1[p].d; + /* Evaluate a truncated power series for Atan(s) */ + n=__atan_np[p]; mptwoim1.d[1] = __atan_twonm1[p].d; __dvd(&mpsm,&mptwoim1,&mpt,p); for (i=n-1; i>1; i--) { mptwoim1.d[1] -= TWO; @@ -94,8 +101,8 @@ void __mpatan(mp_no *x, mp_no *y, int p) { __mul(&mps,&mpt,&mpt1,p); __sub(&mps,&mpt1,&mpt,p); - /* Compute Atan(x) */ - mptwoim1.d[1] = twom[m].d; + /* Compute Atan(x) */ + mptwoim1.d[1] = __atan_twom[m].d; __mul(&mptwoim1,&mpt,y,p); return; diff --git a/libc/sysdeps/ieee754/dbl-64/mpatan.h b/libc/sysdeps/ieee754/dbl-64/mpatan.h index d420ff340..003b06c69 100644 --- a/libc/sysdeps/ieee754/dbl-64/mpatan.h +++ b/libc/sysdeps/ieee754/dbl-64/mpatan.h @@ -1,8 +1,7 @@ - /* * IBM Accurate Mathematical Library * Written by International Business Machines Corp. - * Copyright (C) 2001 Free Software Foundation, Inc. + * Copyright (C) 2001, 2011 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -29,9 +28,18 @@ #ifndef MPATAN_H #define MPATAN_H +extern const number __atan_xm[8] attribute_hidden; +extern const number __atan_twonm1[33] attribute_hidden; +extern const number __atan_twom[8] attribute_hidden; +extern const number __atan_one attribute_hidden; +extern const number __atan_two attribute_hidden; +extern const int __atan_np[33] attribute_hidden; + + +#ifndef AVOID_MPATAN_H #ifdef BIG_ENDI - static const number - xm[8] = { /* x[m] */ + const number + __atan_xm[8] = { /* x[m] */ /**/ {{0x00000000, 0x00000000} }, /* 0.0 */ /**/ {{0x3f8930be, 0x00000000} }, /* 0.0123 */ /**/ {{0x3f991687, 0x00000000} }, /* 0.0245 */ @@ -40,9 +48,9 @@ /**/ {{0x3fc95810, 0x00000000} }, /* 0.198 */ /**/ {{0x3fda7ef9, 0x00000000} }, /* 0.414 */ /**/ {{0x3ff00000, 0x00000000} }, /* 1.0 */ - }; - static const number - twonm1[33] = { /* 2n-1 */ + }; + const number + __atan_twonm1[33] = { /* 2n-1 */ /**/ {{0x00000000, 0x00000000} }, /* 0 */ /**/ {{0x00000000, 0x00000000} }, /* 0 */ /**/ {{0x00000000, 0x00000000} }, /* 0 */ @@ -76,10 +84,10 @@ /**/ {{0x405b4000, 0x00000000} }, /* 109 */ /**/ {{0x405c4000, 0x00000000} }, /* 113 */ /**/ {{0x405d4000, 0x00000000} }, /* 117 */ - }; + }; - static const number - twom[8] = { /* 2**m */ + const number + __atan_twom[8] = { /* 2**m */ /**/ {{0x3ff00000, 0x00000000} }, /* 1.0 */ /**/ {{0x40000000, 0x00000000} }, /* 2.0 */ /**/ {{0x40100000, 0x00000000} }, /* 4.0 */ @@ -88,17 +96,17 @@ /**/ {{0x40400000, 0x00000000} }, /* 32.0 */ /**/ {{0x40500000, 0x00000000} }, /* 64.0 */ /**/ {{0x40600000, 0x00000000} }, /* 128.0 */ - }; + }; - static const number -/**/ one = {{0x3ff00000, 0x00000000} }, /* 1 */ -/**/ two = {{0x40000000, 0x00000000} }; /* 2 */ + const number +/**/ __atan_one = {{0x3ff00000, 0x00000000} }, /* 1 */ +/**/ __atan_two = {{0x40000000, 0x00000000} }; /* 2 */ #else #ifdef LITTLE_ENDI - static const number - xm[8] = { /* x[m] */ + const number + __atan_xm[8] = { /* x[m] */ /**/ {{0x00000000, 0x00000000} }, /* 0.0 */ /**/ {{0x00000000, 0x3f8930be} }, /* 0.0123 */ /**/ {{0x00000000, 0x3f991687} }, /* 0.0245 */ @@ -107,9 +115,9 @@ /**/ {{0x00000000, 0x3fc95810} }, /* 0.198 */ /**/ {{0x00000000, 0x3fda7ef9} }, /* 0.414 */ /**/ {{0x00000000, 0x3ff00000} }, /* 1.0 */ - }; - static const number - twonm1[33] = { /* 2n-1 */ + }; + const number +__atan_twonm1[33] = { /* 2n-1 */ /**/ {{0x00000000, 0x00000000} }, /* 0 */ /**/ {{0x00000000, 0x00000000} }, /* 0 */ /**/ {{0x00000000, 0x00000000} }, /* 0 */ @@ -143,10 +151,10 @@ /**/ {{0x00000000, 0x405b4000} }, /* 109 */ /**/ {{0x00000000, 0x405c4000} }, /* 113 */ /**/ {{0x00000000, 0x405d4000} }, /* 117 */ - }; + }; - static const number - twom[8] = { /* 2**m */ + const number + __atan_twom[8] = { /* 2**m */ /**/ {{0x00000000, 0x3ff00000} }, /* 1.0 */ /**/ {{0x00000000, 0x40000000} }, /* 2.0 */ /**/ {{0x00000000, 0x40100000} }, /* 4.0 */ @@ -155,20 +163,21 @@ /**/ {{0x00000000, 0x40400000} }, /* 32.0 */ /**/ {{0x00000000, 0x40500000} }, /* 64.0 */ /**/ {{0x00000000, 0x40600000} }, /* 128.0 */ - }; + }; - static const number -/**/ one = {{0x00000000, 0x3ff00000} }, /* 1 */ -/**/ two = {{0x00000000, 0x40000000} }; /* 2 */ + const number +/**/ __atan_one = {{0x00000000, 0x3ff00000} }, /* 1 */ +/**/ __atan_two = {{0x00000000, 0x40000000} }; /* 2 */ #endif #endif -#define ONE one.d -#define TWO two.d - - static const int - np[33] = { 0, 0, 0, 0, 6, 8,10,11,13,15,17,19,21,23,25,27,28, - 30,32,34,36,38,40,42,43,45,47,49,51,53,55,57,59}; + const int + __atan_np[33] = { 0, 0, 0, 0, 6, 8,10,11,13,15,17,19,21,23,25,27,28, + 30,32,34,36,38,40,42,43,45,47,49,51,53,55,57,59}; #endif +#endif + +#define ONE __atan_one.d +#define TWO __atan_two.d diff --git a/libc/sysdeps/ieee754/dbl-64/mpatan2.c b/libc/sysdeps/ieee754/dbl-64/mpatan2.c index 8977ec904..1deb05641 100644 --- a/libc/sysdeps/ieee754/dbl-64/mpatan2.c +++ b/libc/sysdeps/ieee754/dbl-64/mpatan2.c @@ -1,8 +1,7 @@ - /* * IBM Accurate Mathematical Library * written by International Business Machines Corp. - * Copyright (C) 2001 Free Software Foundation + * Copyright (C) 2001, 2011 Free Software Foundation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -38,18 +37,24 @@ #include "mpa.h" +#ifndef SECTION +# define SECTION +#endif + void __mpsqrt(mp_no *, mp_no *, int); void __mpatan(mp_no *, mp_no *, int); /* Multi-Precision Atan2(y,x) function subroutine, for p >= 4. */ /* y=0 is not permitted if x<=0. No error messages are given. */ -void __mpatan2(mp_no *y, mp_no *x, mp_no *z, int p) { +void +SECTION +__mpatan2(mp_no *y, mp_no *x, mp_no *z, int p) { static const double ZERO = 0.0, ONE = 1.0; mp_no mpone = {0,{0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0, - 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0, - 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0}}; + 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0, + 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0}}; mp_no mpt1,mpt2,mpt3; diff --git a/libc/sysdeps/ieee754/dbl-64/mpexp.c b/libc/sysdeps/ieee754/dbl-64/mpexp.c index e2ab71b2c..b0cffe2fe 100644 --- a/libc/sysdeps/ieee754/dbl-64/mpexp.c +++ b/libc/sysdeps/ieee754/dbl-64/mpexp.c @@ -1,8 +1,7 @@ - /* * IBM Accurate Mathematical Library * written by International Business Machines Corp. - * Copyright (C) 2001 Free Software Foundation + * Copyright (C) 2001, 2011 Free Software Foundation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -34,34 +33,40 @@ #include "mpa.h" #include "mpexp.h" +#ifndef SECTION +# define SECTION +#endif + /* Multi-Precision exponential function subroutine (for p >= 4, */ /* 2**(-55) <= abs(x) <= 1024). */ -void __mpexp(mp_no *x, mp_no *y, int p) { +void +SECTION +__mpexp(mp_no *x, mp_no *y, int p) { int i,j,k,m,m1,m2,n; double a,b; static const int np[33] = {0,0,0,0,3,3,4,4,5,4,4,5,5,5,6,6,6,6,6,6, - 6,6,6,6,7,7,7,7,8,8,8,8,8}; + 6,6,6,6,7,7,7,7,8,8,8,8,8}; static const int m1p[33]= {0,0,0,0,17,23,23,28,27,38,42,39,43,47,43,47,50,54, - 57,60,64,67,71,74,68,71,74,77,70,73,76,78,81}; + 57,60,64,67,71,74,68,71,74,77,70,73,76,78,81}; static const int m1np[7][18] = { - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0,36,48,60,72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0,24,32,40,48,56,64,72, 0, 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0,17,23,29,35,41,47,53,59,65, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0,23,28,33,38,42,47,52,57,62,66, 0, 0}, - { 0, 0, 0, 0, 0, 0, 0, 0,27, 0, 0,39,43,47,51,55,59,63}, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,43,47,50,54}}; + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0,36,48,60,72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0,24,32,40,48,56,64,72, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0,17,23,29,35,41,47,53,59,65, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0,23,28,33,38,42,47,52,57,62,66, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0,27, 0, 0,39,43,47,51,55,59,63}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,43,47,50,54}}; mp_no mpone = {0,{0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0, - 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0, - 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0}}; + 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0, + 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0}}; mp_no mpk = {0,{0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0, - 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0, - 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0}}; + 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0, + 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0}}; mp_no mps,mpak,mpt1,mpt2; /* Choose m,n and compute a=2**(-m) */ - n = np[p]; m1 = m1p[p]; a = twomm1[p].d; + n = np[p]; m1 = m1p[p]; a = __mpexp_twomm1[p].d; for (i=0; iEX; i--) a *= RADIX; b = X[1]*RADIXI; m2 = 24*EX; @@ -81,12 +86,12 @@ void __mpexp(mp_no *x, mp_no *y, int p) { /* Evaluate the polynomial. Put result in mpt2 */ mpone.e=1; mpone.d[0]=ONE; mpone.d[1]=ONE; - mpk.e = 1; mpk.d[0] = ONE; mpk.d[1]=nn[n].d; + mpk.e = 1; mpk.d[0] = ONE; mpk.d[1]=__mpexp_nn[n].d; __dvd(&mps,&mpk,&mpt1,p); __add(&mpone,&mpt1,&mpak,p); for (k=n-1; k>1; k--) { __mul(&mps,&mpak,&mpt1,p); - mpk.d[1]=nn[k].d; + mpk.d[1]=__mpexp_nn[k].d; __dvd(&mpt1,&mpk,&mpt2,p); __add(&mpone,&mpt2,&mpak,p); } diff --git a/libc/sysdeps/ieee754/dbl-64/mpexp.h b/libc/sysdeps/ieee754/dbl-64/mpexp.h index a0b08ccb4..7985060a8 100644 --- a/libc/sysdeps/ieee754/dbl-64/mpexp.h +++ b/libc/sysdeps/ieee754/dbl-64/mpexp.h @@ -1,7 +1,7 @@ /* * IBM Accurate Mathematical Library * Written by International Business Machines Corp. - * Copyright (C) 2001 Free Software Foundation, Inc. + * Copyright (C) 2001, 2011 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -28,9 +28,20 @@ #ifndef MPEXP_H #define MPEXP_H +extern const number __mpexp_twomm1[33] attribute_hidden; +extern const number __mpexp_nn[9] attribute_hidden; +extern const number __mpexp_radix attribute_hidden; +extern const number __mpexp_radixi attribute_hidden; +extern const number __mpexp_zero attribute_hidden; +extern const number __mpexp_one attribute_hidden; +extern const number __mpexp_two attribute_hidden; +extern const number __mpexp_half attribute_hidden; + + +#ifndef AVOID_MPEXP_H #ifdef BIG_ENDI - static const number - twomm1[33] = { /* 2**-m1 */ + const number + __mpexp_twomm1[33] = { /* 2**-m1 */ /**/ {{0x00000000, 0x00000000} }, /* 0 */ /**/ {{0x00000000, 0x00000000} }, /* 0 */ /**/ {{0x00000000, 0x00000000} }, /* 0 */ @@ -65,8 +76,8 @@ /**/ {{0x3b100000, 0x00000000} }, /* 2**-78 */ /**/ {{0x3ae00000, 0x00000000} }, /* 2**-81 */ }; - static const number - nn[9]={ /* n */ + const number + __mpexp_nn[9]={ /* n */ /**/ {{0x00000000, 0x00000000} }, /* 0 */ /**/ {{0x3ff00000, 0x00000000} }, /* 1 */ /**/ {{0x40000000, 0x00000000} }, /* 2 */ @@ -78,18 +89,18 @@ /**/ {{0x40200000, 0x00000000} }, /* 8 */ }; - static const number -/**/ radix = {{0x41700000, 0x00000000} }, /* 2**24 */ -/**/ radixi = {{0x3e700000, 0x00000000} }, /* 2**-24 */ -/**/ zero = {{0x00000000, 0x00000000} }, /* 0 */ -/**/ one = {{0x3ff00000, 0x00000000} }, /* 1 */ -/**/ two = {{0x40000000, 0x00000000} }, /* 2 */ -/**/ half = {{0x3fe00000, 0x00000000} }; /* 1/2 */ + const number +/**/ __mpexp_radix = {{0x41700000, 0x00000000} }, /* 2**24 */ +/**/ __mpexp_radixi = {{0x3e700000, 0x00000000} }, /* 2**-24 */ +/**/ __mpexp_zero = {{0x00000000, 0x00000000} }, /* 0 */ +/**/ __mpexp_one = {{0x3ff00000, 0x00000000} }, /* 1 */ +/**/ __mpexp_two = {{0x40000000, 0x00000000} }, /* 2 */ +/**/ __mpexp_half = {{0x3fe00000, 0x00000000} }; /* 1/2 */ #else #ifdef LITTLE_ENDI - static const number - twomm1[33] = { /* 2**-m1 */ + const number + __mpexp_twomm1[33] = { /* 2**-m1 */ /**/ {{0x00000000, 0x00000000} }, /* 0 */ /**/ {{0x00000000, 0x00000000} }, /* 0 */ /**/ {{0x00000000, 0x00000000} }, /* 0 */ @@ -124,8 +135,8 @@ /**/ {{0x00000000, 0x3b100000} }, /* 2**-78 */ /**/ {{0x00000000, 0x3ae00000} }, /* 2**-81 */ }; - static const number - nn[9]={ /* n */ + const number + __mpexp_nn[9]={ /* n */ /**/ {{0x00000000, 0x00000000} }, /* 0 */ /**/ {{0x00000000, 0x3ff00000} }, /* 1 */ /**/ {{0x00000000, 0x40000000} }, /* 2 */ @@ -137,22 +148,23 @@ /**/ {{0x00000000, 0x40200000} }, /* 8 */ }; - static const number -/**/ radix = {{0x00000000, 0x41700000} }, /* 2**24 */ -/**/ radixi = {{0x00000000, 0x3e700000} }, /* 2**-24 */ -/**/ zero = {{0x00000000, 0x00000000} }, /* 0 */ -/**/ one = {{0x00000000, 0x3ff00000} }, /* 1 */ -/**/ two = {{0x00000000, 0x40000000} }, /* 2 */ -/**/ half = {{0x00000000, 0x3fe00000} }; /* 1/2 */ + const number +/**/ __mpexp_radix = {{0x00000000, 0x41700000} }, /* 2**24 */ +/**/ __mpexp_radixi = {{0x00000000, 0x3e700000} }, /* 2**-24 */ +/**/ __mpexp_zero = {{0x00000000, 0x00000000} }, /* 0 */ +/**/ __mpexp_one = {{0x00000000, 0x3ff00000} }, /* 1 */ +/**/ __mpexp_two = {{0x00000000, 0x40000000} }, /* 2 */ +/**/ __mpexp_half = {{0x00000000, 0x3fe00000} }; /* 1/2 */ +#endif #endif #endif -#define RADIX radix.d -#define RADIXI radixi.d -#define ZERO zero.d -#define ONE one.d -#define TWO two.d -#define HALF half.d +#define RADIX __mpexp_radix.d +#define RADIXI __mpexp_radixi.d +#define ZERO __mpexp_zero.d +#define ONE __mpexp_one.d +#define TWO __mpexp_two.d +#define HALF __mpexp_half.d #endif diff --git a/libc/sysdeps/ieee754/dbl-64/mpsqrt.c b/libc/sysdeps/ieee754/dbl-64/mpsqrt.c index 9945de306..d1a80f909 100644 --- a/libc/sysdeps/ieee754/dbl-64/mpsqrt.c +++ b/libc/sysdeps/ieee754/dbl-64/mpsqrt.c @@ -1,8 +1,7 @@ - /* * IBM Accurate Mathematical Library * written by International Business Machines Corp. - * Copyright (C) 2001 Free Software Foundation + * Copyright (C) 2001, 2011 Free Software Foundation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -33,6 +32,12 @@ #include "endian.h" #include "mpa.h" +#ifndef SECTION +# define SECTION +#endif + +#include "mpsqrt.h" + /****************************************************************************/ /* Multi-Precision square root function subroutine for precision p >= 4. */ /* The relative error is bounded by 3.501*r**(1-p), where r=2**24. */ @@ -41,20 +46,20 @@ /* p as integer. Routine computes sqrt(*x) and stores result in *y */ /****************************************************************************/ -double fastiroot(double); - -void __mpsqrt(mp_no *x, mp_no *y, int p) { -#include "mpsqrt.h" +static double fastiroot(double); +void +SECTION +__mpsqrt(mp_no *x, mp_no *y, int p) { int i,m,ex,ey; double dx,dy; mp_no mphalf = {0,{0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0, - 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0, - 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0}}, + 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0, + 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0}}, mp3halfs = {0,{0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0, - 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0, - 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0}}; + 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0, + 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0}}; mp_no mpxn,mpz,mpu,mpt1,mpt2; /* Prepare multi-precision 1/2 and 3/2 */ @@ -65,7 +70,7 @@ void __mpsqrt(mp_no *x, mp_no *y, int p) { __mp_dbl(&mpxn,&dx,p); dy=fastiroot(dx); __dbl_mp(dy,&mpu,p); __mul(&mpxn,&mphalf,&mpz,p); - m=mp[p]; + m=__mpsqrt_mp[p]; for (i=0; i>20)&0x7ff)-0x3ff; if(j0<20) { - if(j0<0) { /* raise inexact if x != 0 */ - if(huge+x>0.0) {/* return 0*sign(x) if |x|<1 */ - if(i0<0) {i0=0x80000000;i1=0;} - else if((i0|i1)!=0) { i0=0x3ff00000;i1=0;} - } + if(j0<0) { /* raise inexact if x != 0 */ + math_force_eval(huge+x); + /* return 0*sign(x) if |x|<1 */ + if(i0<0) {i0=0x80000000;i1=0;} + else if((i0|i1)!=0) { i0=0x3ff00000;i1=0;} } else { i = (0x000fffff)>>j0; if(((i0&i)|i1)==0) return x; /* x is integral */ - if(huge+x>0.0) { /* raise inexact flag */ - if(i0>0) i0 += (0x00100000)>>j0; - i0 &= (~i); i1=0; - } + math_force_eval(huge+x); /* raise inexact flag */ + if(i0>0) i0 += (0x00100000)>>j0; + i0 &= (~i); i1=0; } } else if (j0>51) { if(j0==0x400) return x+x; /* inf or NaN */ @@ -51,17 +50,16 @@ __ceil(double x) } else { i = ((u_int32_t)(0xffffffff))>>(j0-20); if((i1&i)==0) return x; /* x is integral */ - if(huge+x>0.0) { /* raise inexact flag */ - if(i0>0) { - if(j0==20) i0+=1; - else { - j = i1 + (1<<(52-j0)); - if(j0) { + if(j0==20) i0+=1; + else { + j = i1 + (1<<(52-j0)); + if(j56) return 2^k(1-(E-r)) - 1 (or exp(x)-1) * (vi) if k <= 20, return 2^k((1-2^-k)-(E-r)), else * (vii) return 2^k(1-((E+2^-k)-r)) @@ -116,11 +112,7 @@ static char rcsid[] = "$NetBSD: s_expm1.c,v 1.8 1995/05/10 20:47:09 jtc Exp $"; #include "math.h" #include "math_private.h" #define one Q[0] -#ifdef __STDC__ static const double -#else -static double -#endif huge = 1.0e+300, tiny = 1.0e-300, o_threshold = 7.09782712893383973096e+02,/* 0x40862E42, 0xFEFA39EF */ @@ -134,12 +126,8 @@ Q[] = {1.0, -3.33333333333331316428e-02, /* BFA11111 111110F4 */ 4.00821782732936239552e-06, /* 3ED0CFCA 86E65239 */ -2.01099218183624371326e-07}; /* BE8AFDB7 6E09C32D */ -#ifdef __STDC__ - double __expm1(double x) -#else - double __expm1(x) - double x; -#endif +double +__expm1(double x) { double y,hi,lo,c,t,e,hxs,hfx,r1,h2,h4,R1,R2,R3; int32_t k,xsb; @@ -153,20 +141,20 @@ Q[] = {1.0, -3.33333333333331316428e-02, /* BFA11111 111110F4 */ /* filter out huge and non-finite argument */ if(hx >= 0x4043687A) { /* if |x|>=56*ln2 */ if(hx >= 0x40862E42) { /* if |x|>=709.78... */ - if(hx>=0x7ff00000) { + if(hx>=0x7ff00000) { u_int32_t low; GET_LOW_WORD(low,x); if(((hx&0xfffff)|low)!=0) - return x+x; /* NaN */ + return x+x; /* NaN */ else return (xsb==0)? x:-1.0;/* exp(+-inf)={inf,-1} */ - } - if(x > o_threshold) { + } + if(x > o_threshold) { __set_errno (ERANGE); return huge*huge; /* overflow */ } } if(xsb!=0) { /* x < -56*ln2, return -1.0 with inexact */ - if(x+tiny<0.0) /* raise inexact */ + math_force_eval(x+tiny); /* raise inexact */ return tiny-one; /* return -1 */ } } @@ -187,7 +175,7 @@ Q[] = {1.0, -3.33333333333331316428e-02, /* BFA11111 111110F4 */ x = hi - lo; c = (hi-x)-lo; } - else if(hx < 0x3c900000) { /* when |x|<2**-54, return x */ + else if(hx < 0x3c900000) { /* when |x|<2**-54, return x */ t = huge+x; /* return x with inexact flags when x!=0 */ return x - (t-(huge+x)); } @@ -212,28 +200,28 @@ Q[] = {1.0, -3.33333333333331316428e-02, /* BFA11111 111110F4 */ e -= hxs; if(k== -1) return 0.5*(x-e)-0.5; if(k==1) { - if(x < -0.25) return -2.0*(e-(x+0.5)); - else return one+2.0*(x-e); + if(x < -0.25) return -2.0*(e-(x+0.5)); + else return one+2.0*(x-e); } if (k <= -2 || k>56) { /* suffice to return exp(x)-1 */ - u_int32_t high; - y = one-(e-x); + u_int32_t high; + y = one-(e-x); GET_HIGH_WORD(high,y); SET_HIGH_WORD(y,high+(k<<20)); /* add k to y's exponent */ - return y-one; + return y-one; } t = one; if(k<20) { - u_int32_t high; - SET_HIGH_WORD(t,0x3ff00000 - (0x200000>>k)); /* t=1-2^-k */ - y = t-(e-x); + u_int32_t high; + SET_HIGH_WORD(t,0x3ff00000 - (0x200000>>k)); /* t=1-2^-k */ + y = t-(e-x); GET_HIGH_WORD(high,y); SET_HIGH_WORD(y,high+(k<<20)); /* add k to y's exponent */ } else { - u_int32_t high; + u_int32_t high; SET_HIGH_WORD(t,((0x3ff-k)<<20)); /* 2^-k */ - y = x-(e+t); - y += one; + y = x-(e+t); + y += one; GET_HIGH_WORD(high,y); SET_HIGH_WORD(y,high+(k<<20)); /* add k to y's exponent */ } diff --git a/libc/sysdeps/ieee754/dbl-64/s_floor.c b/libc/sysdeps/ieee754/dbl-64/s_floor.c index 5b593ca31..8b2038e69 100644 --- a/libc/sysdeps/ieee754/dbl-64/s_floor.c +++ b/libc/sysdeps/ieee754/dbl-64/s_floor.c @@ -41,18 +41,16 @@ static double huge = 1.0e300; j0 = ((i0>>20)&0x7ff)-0x3ff; if(j0<20) { if(j0<0) { /* raise inexact if x != 0 */ - if(huge+x>0.0) {/* return 0*sign(x) if |x|<1 */ - if(i0>=0) {i0=i1=0;} - else if(((i0&0x7fffffff)|i1)!=0) - { i0=0xbff00000;i1=0;} - } + math_force_eval(huge+x);/* return 0*sign(x) if |x|<1 */ + if(i0>=0) {i0=i1=0;} + else if(((i0&0x7fffffff)|i1)!=0) + { i0=0xbff00000;i1=0;} } else { i = (0x000fffff)>>j0; if(((i0&i)|i1)==0) return x; /* x is integral */ - if(huge+x>0.0) { /* raise inexact flag */ - if(i0<0) i0 += (0x00100000)>>j0; - i0 &= (~i); i1=0; - } + math_force_eval(huge+x); /* raise inexact flag */ + if(i0<0) i0 += (0x00100000)>>j0; + i0 &= (~i); i1=0; } } else if (j0>51) { if(j0==0x400) return x+x; /* inf or NaN */ @@ -60,17 +58,16 @@ static double huge = 1.0e300; } else { i = ((u_int32_t)(0xffffffff))>>(j0-20); if((i1&i)==0) return x; /* x is integral */ - if(huge+x>0.0) { /* raise inexact flag */ - if(i0<0) { - if(j0==20) i0+=1; - else { - j = i1+(1<<(52-j0)); - if(jzero /* raise inexact */ - &&ax<0x3c900000) /* |x| < 2**-54 */ + math_force_eval(two54+x); /* raise inexact */ + if (ax<0x3c900000) /* |x| < 2**-54 */ return x; else return x - x*x*0.5; @@ -141,22 +125,22 @@ static double zero = 0.0; if(hx<0x43400000) { u = 1.0+x; GET_HIGH_WORD(hu,u); - k = (hu>>20)-1023; - c = (k>0)? 1.0-(u-x):x-(u-1.0);/* correction term */ + k = (hu>>20)-1023; + c = (k>0)? 1.0-(u-x):x-(u-1.0);/* correction term */ c /= u; } else { u = x; GET_HIGH_WORD(hu,u); - k = (hu>>20)-1023; + k = (hu>>20)-1023; c = 0; } hu &= 0x000fffff; if(hu<0x6a09e) { - SET_HIGH_WORD(u,hu|0x3ff00000); /* normalize u */ + SET_HIGH_WORD(u,hu|0x3ff00000); /* normalize u */ } else { - k += 1; + k += 1; SET_HIGH_WORD(u,hu|0x3fe00000); /* normalize u/2 */ - hu = (0x00100000-hu)>>2; + hu = (0x00100000-hu)>>2; } f = u-1.0; } @@ -168,9 +152,9 @@ static double zero = 0.0; } R = hfsq*(1.0-0.66666666666666666*f); if(k==0) return f-R; else - return k*ln2_hi-((R-(k*ln2_lo+c))-f); + return k*ln2_hi-((R-(k*ln2_lo+c))-f); } - s = f/(2.0+f); + s = f/(2.0+f); z = s*s; #ifdef DO_NOT_USE_THIS R = z*(Lp1+z*(Lp2+z*(Lp3+z*(Lp4+z*(Lp5+z*(Lp6+z*Lp7)))))); diff --git a/libc/sysdeps/ieee754/dbl-64/s_round.c b/libc/sysdeps/ieee754/dbl-64/s_round.c index 94fcde0e4..f8a38163f 100644 --- a/libc/sysdeps/ieee754/dbl-64/s_round.c +++ b/libc/sysdeps/ieee754/dbl-64/s_round.c @@ -1,5 +1,5 @@ /* Round double to integer away from zero. - Copyright (C) 1997 Free Software Foundation, Inc. + Copyright (C) 1997, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1997. @@ -38,13 +38,12 @@ __round (double x) { if (j0 < 0) { - if (huge + x > 0.0) - { - i0 &= 0x80000000; - if (j0 == -1) - i0 |= 0x3ff00000; - i1 = 0; - } + math_force_eval (huge + x > 0.0); + + i0 &= 0x80000000; + if (j0 == -1) + i0 |= 0x3ff00000; + i1 = 0; } else { @@ -52,13 +51,12 @@ __round (double x) if (((i0 & i) | i1) == 0) /* X is integral. */ return x; - if (huge + x > 0.0) - { - /* Raise inexact if x != 0. */ - i0 += 0x00080000 >> j0; - i0 &= ~i; - i1 = 0; - } + math_force_eval (huge + x > 0.0); + + /* Raise inexact if x != 0. */ + i0 += 0x00080000 >> j0; + i0 &= ~i; + i1 = 0; } } else if (j0 > 51) @@ -76,14 +74,13 @@ __round (double x) /* X is integral. */ return x; - if (huge + x > 0.0) - { - /* Raise inexact if x != 0. */ - u_int32_t j = i1 + (1 << (51 - j0)); - if (j < i1) - i0 += 1; - i1 = j; - } + math_force_eval (huge + x > 0.0); + + /* Raise inexact if x != 0. */ + u_int32_t j = i1 + (1 << (51 - j0)); + if (j < i1) + i0 += 1; + i1 = j; i1 &= ~i; } diff --git a/libc/sysdeps/ieee754/dbl-64/s_sin.c b/libc/sysdeps/ieee754/dbl-64/s_sin.c index b40776f5e..6f19f158f 100644 --- a/libc/sysdeps/ieee754/dbl-64/s_sin.c +++ b/libc/sysdeps/ieee754/dbl-64/s_sin.c @@ -1,7 +1,7 @@ /* * IBM Accurate Mathematical Library * written by International Business Machines Corp. - * Copyright (C) 2001, 2009 Free Software Foundation + * Copyright (C) 2001, 2009, 2011 Free Software Foundation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -53,15 +53,24 @@ #include "mydefs.h" #include "usncs.h" #include "MathLib.h" -#include "sincos.tbl" #include "math_private.h" +#ifndef SECTION +# define SECTION +#endif + +extern const union +{ + int4 i[880]; + double x[440]; +} __sincostab attribute_hidden; + static const double - sn3 = -1.66666666666664880952546298448555E-01, - sn5 = 8.33333214285722277379541354343671E-03, - cs2 = 4.99999999999999999999950396842453E-01, - cs4 = -4.16666666666664434524222570944589E-02, - cs6 = 1.38888874007937613028114285595617E-03; + sn3 = -1.66666666666664880952546298448555E-01, + sn5 = 8.33333214285722277379541354343671E-03, + cs2 = 4.99999999999999999999950396842453E-01, + cs4 = -4.16666666666664434524222570944589E-02, + cs6 = 1.38888874007937613028114285595617E-03; void __dubsin(double x, double dx, double w[]); void __docos(double x, double dx, double w[]); @@ -87,7 +96,9 @@ static double csloww2(double x, double dx, double orig, int n); /* An ultimate sin routine. Given an IEEE double machine number x */ /* it computes the correctly rounded (to nearest) value of sin(x) */ /*******************************************************************/ -double __sin(double x){ +double +SECTION +__sin(double x){ double xx,res,t,cor,y,s,c,sn,ssn,cs,ccs,xn,a,da,db,eps,xn1,xn2; #if 0 double w[2]; @@ -120,10 +131,10 @@ double __sin(double x){ s = y + y*xx*(sn3 +xx*sn5); c = xx*(cs2 +xx*(cs4 + xx*cs6)); k=u.i[LOW_HALF]<<2; - sn=(m>0)?sincos.x[k]:-sincos.x[k]; - ssn=(m>0)?sincos.x[k+1]:-sincos.x[k+1]; - cs=sincos.x[k+2]; - ccs=sincos.x[k+3]; + sn=(m>0)?__sincostab.x[k]:-__sincostab.x[k]; + ssn=(m>0)?__sincostab.x[k+1]:-__sincostab.x[k+1]; + cs=__sincostab.x[k+2]; + ccs=__sincostab.x[k+3]; cor=(ssn+s*ccs-sn*c)+cs*s; res=sn+cor; cor=(sn-res)+cor; @@ -146,10 +157,10 @@ double __sin(double x){ s = y + y*xx*(sn3 +xx*sn5); c = xx*(cs2 +xx*(cs4 + xx*cs6)); k=u.i[LOW_HALF]<<2; - sn=sincos.x[k]; - ssn=sincos.x[k+1]; - cs=sincos.x[k+2]; - ccs=sincos.x[k+3]; + sn=__sincostab.x[k]; + ssn=__sincostab.x[k+1]; + cs=__sincostab.x[k+2]; + ccs=__sincostab.x[k+3]; cor=(ccs-s*ssn-cs*c)-sn*s; res=cs+cor; cor=(cs-res)+cor; @@ -174,7 +185,7 @@ double __sin(double x){ xx = a*a; if (n) {a=-a;da=-da;} if (xx < 0.01588) { - /*Taylor series */ + /*Taylor series */ t = (((((s5.x*xx + s4.x)*xx + s3.x)*xx + s2.x)*xx + s1.x)*a - 0.5*da)*xx+da; res = a+t; cor = (a-res)+t; @@ -192,10 +203,10 @@ double __sin(double x){ s = y + (db+y*xx*(sn3 +xx*sn5)); c = y*db+xx*(cs2 +xx*(cs4 + xx*cs6)); k=u.i[LOW_HALF]<<2; - sn=sincos.x[k]; - ssn=sincos.x[k+1]; - cs=sincos.x[k+2]; - ccs=sincos.x[k+3]; + sn=__sincostab.x[k]; + ssn=__sincostab.x[k+1]; + cs=__sincostab.x[k+2]; + ccs=__sincostab.x[k+3]; cor=(ssn+s*ccs-sn*c)+cs*s; res=sn+cor; cor=(sn-res)+cor; @@ -212,10 +223,10 @@ double __sin(double x){ y=a-(u.x-big.x)+da; xx=y*y; k=u.i[LOW_HALF]<<2; - sn=sincos.x[k]; - ssn=sincos.x[k+1]; - cs=sincos.x[k+2]; - ccs=sincos.x[k+3]; + sn=__sincostab.x[k]; + ssn=__sincostab.x[k+1]; + cs=__sincostab.x[k+2]; + ccs=__sincostab.x[k+3]; s = y + y*xx*(sn3 +xx*sn5); c = xx*(cs2 +xx*(cs4 + xx*cs6)); cor=(ccs-s*ssn-cs*c)-sn*s; @@ -253,7 +264,7 @@ double __sin(double x){ xx = a*a; if (n) {a=-a;da=-da;} if (xx < 0.01588) { - /* Taylor series */ + /* Taylor series */ t = (((((s5.x*xx + s4.x)*xx + s3.x)*xx + s2.x)*xx + s1.x)*a - 0.5*da)*xx+da; res = a+t; cor = (a-res)+t; @@ -269,10 +280,10 @@ double __sin(double x){ s = y + (db+y*xx*(sn3 +xx*sn5)); c = y*db+xx*(cs2 +xx*(cs4 + xx*cs6)); k=u.i[LOW_HALF]<<2; - sn=sincos.x[k]; - ssn=sincos.x[k+1]; - cs=sincos.x[k+2]; - ccs=sincos.x[k+3]; + sn=__sincostab.x[k]; + ssn=__sincostab.x[k+1]; + cs=__sincostab.x[k+2]; + ccs=__sincostab.x[k+3]; cor=(ssn+s*ccs-sn*c)+cs*s; res=sn+cor; cor=(sn-res)+cor; @@ -289,10 +300,10 @@ double __sin(double x){ y=a-(u.x-big.x)+da; xx=y*y; k=u.i[LOW_HALF]<<2; - sn=sincos.x[k]; - ssn=sincos.x[k+1]; - cs=sincos.x[k+2]; - ccs=sincos.x[k+3]; + sn=__sincostab.x[k]; + ssn=__sincostab.x[k+1]; + cs=__sincostab.x[k+2]; + ccs=__sincostab.x[k+3]; s = y + y*xx*(sn3 +xx*sn5); c = xx*(cs2 +xx*(cs4 + xx*cs6)); cor=(ccs-s*ssn-cs*c)-sn*s; @@ -344,7 +355,9 @@ double __sin(double x){ /* it computes the correctly rounded (to nearest) value of cos(x) */ /*******************************************************************/ -double __cos(double x) +double +SECTION +__cos(double x) { double y,xx,res,t,cor,s,c,sn,ssn,cs,ccs,xn,a,da,db,eps,xn1,xn2; mynumber u,v; @@ -364,10 +377,10 @@ double __cos(double x) s = y + y*xx*(sn3 +xx*sn5); c = xx*(cs2 +xx*(cs4 + xx*cs6)); k=u.i[LOW_HALF]<<2; - sn=sincos.x[k]; - ssn=sincos.x[k+1]; - cs=sincos.x[k+2]; - ccs=sincos.x[k+3]; + sn=__sincostab.x[k]; + ssn=__sincostab.x[k+1]; + cs=__sincostab.x[k+2]; + ccs=__sincostab.x[k+3]; cor=(ccs-s*ssn-cs*c)-sn*s; res=cs+cor; cor=(cs-res)+cor; @@ -396,10 +409,10 @@ double __cos(double x) s = y + (db+y*xx*(sn3 +xx*sn5)); c = y*db+xx*(cs2 +xx*(cs4 + xx*cs6)); k=u.i[LOW_HALF]<<2; - sn=sincos.x[k]; - ssn=sincos.x[k+1]; - cs=sincos.x[k+2]; - ccs=sincos.x[k+3]; + sn=__sincostab.x[k]; + ssn=__sincostab.x[k+1]; + cs=__sincostab.x[k+2]; + ccs=__sincostab.x[k+3]; cor=(ssn+s*ccs-sn*c)+cs*s; res=sn+cor; cor=(sn-res)+cor; @@ -442,10 +455,10 @@ double __cos(double x) s = y + (db+y*xx*(sn3 +xx*sn5)); c = y*db+xx*(cs2 +xx*(cs4 + xx*cs6)); k=u.i[LOW_HALF]<<2; - sn=sincos.x[k]; - ssn=sincos.x[k+1]; - cs=sincos.x[k+2]; - ccs=sincos.x[k+3]; + sn=__sincostab.x[k]; + ssn=__sincostab.x[k+1]; + cs=__sincostab.x[k+2]; + ccs=__sincostab.x[k+3]; cor=(ssn+s*ccs-sn*c)+cs*s; res=sn+cor; cor=(sn-res)+cor; @@ -461,10 +474,10 @@ double __cos(double x) y=a-(u.x-big.x)+da; xx=y*y; k=u.i[LOW_HALF]<<2; - sn=sincos.x[k]; - ssn=sincos.x[k+1]; - cs=sincos.x[k+2]; - ccs=sincos.x[k+3]; + sn=__sincostab.x[k]; + ssn=__sincostab.x[k+1]; + cs=__sincostab.x[k+2]; + ccs=__sincostab.x[k+3]; s = y + y*xx*(sn3 +xx*sn5); c = xx*(cs2 +xx*(cs4 + xx*cs6)); cor=(ccs-s*ssn-cs*c)-sn*s; @@ -473,7 +486,7 @@ double __cos(double x) cor = (cor>0)? 1.025*cor+eps : 1.025*cor-eps; return (res==res+cor)? ((n)?-res:res) : csloww2(a,da,x,n); - break; + break; } @@ -517,10 +530,10 @@ double __cos(double x) s = y + (db+y*xx*(sn3 +xx*sn5)); c = y*db+xx*(cs2 +xx*(cs4 + xx*cs6)); k=u.i[LOW_HALF]<<2; - sn=sincos.x[k]; - ssn=sincos.x[k+1]; - cs=sincos.x[k+2]; - ccs=sincos.x[k+3]; + sn=__sincostab.x[k]; + ssn=__sincostab.x[k+1]; + cs=__sincostab.x[k+2]; + ccs=__sincostab.x[k+3]; cor=(ssn+s*ccs-sn*c)+cs*s; res=sn+cor; cor=(sn-res)+cor; @@ -536,10 +549,10 @@ double __cos(double x) y=a-(u.x-big.x)+da; xx=y*y; k=u.i[LOW_HALF]<<2; - sn=sincos.x[k]; - ssn=sincos.x[k+1]; - cs=sincos.x[k+2]; - ccs=sincos.x[k+3]; + sn=__sincostab.x[k]; + ssn=__sincostab.x[k+1]; + cs=__sincostab.x[k+2]; + ccs=__sincostab.x[k+3]; s = y + y*xx*(sn3 +xx*sn5); c = xx*(cs2 +xx*(cs4 + xx*cs6)); cor=(ccs-s*ssn-cs*c)-sn*s; @@ -591,7 +604,9 @@ double __cos(double x) /* precision and if still doesn't accurate enough by mpsin or dubsin */ /************************************************************************/ -static double slow(double x) { +static double +SECTION +slow(double x) { static const double th2_36 = 206158430208.0; /* 1.5*2**37 */ double y,x1,x2,xx,r,t,res,cor,w[2]; x1=(x+th2_36)-th2_36; @@ -611,11 +626,13 @@ static const double th2_36 = 206158430208.0; /* 1.5*2**37 */ } } /*******************************************************************************/ -/* Routine compute sin(x) for 0.25<|x|< 0.855469 by sincos.tbl and Taylor */ +/* Routine compute sin(x) for 0.25<|x|< 0.855469 by __sincostab.tbl and Taylor */ /* and if result still doesn't accurate enough by mpsin or dubsin */ /*******************************************************************************/ -static double slow1(double x) { +static double +SECTION +slow1(double x) { mynumber u; double sn,ssn,cs,ccs,s,c,w[2],y,y1,y2,c1,c2,xx,cor,res; static const double t22 = 6291456.0; @@ -627,10 +644,10 @@ static double slow1(double x) { s = y*xx*(sn3 +xx*sn5); c = xx*(cs2 +xx*(cs4 + xx*cs6)); k=u.i[LOW_HALF]<<2; - sn=sincos.x[k]; /* Data */ - ssn=sincos.x[k+1]; /* from */ - cs=sincos.x[k+2]; /* tables */ - ccs=sincos.x[k+3]; /* sincos.tbl */ + sn=__sincostab.x[k]; /* Data */ + ssn=__sincostab.x[k+1]; /* from */ + cs=__sincostab.x[k+2]; /* tables */ + ccs=__sincostab.x[k+3]; /* __sincostab.tbl */ y1 = (y+t22)-t22; y2 = y - y1; c1 = (cs+t22)-t22; @@ -648,10 +665,12 @@ static double slow1(double x) { } } /**************************************************************************/ -/* Routine compute sin(x) for 0.855469 <|x|<2.426265 by sincos.tbl */ +/* Routine compute sin(x) for 0.855469 <|x|<2.426265 by __sincostab.tbl */ /* and if result still doesn't accurate enough by mpsin or dubsin */ /**************************************************************************/ -static double slow2(double x) { +static double +SECTION +slow2(double x) { mynumber u; double sn,ssn,cs,ccs,s,c,w[2],y,y1,y2,e1,e2,xx,cor,res,del; static const double t22 = 6291456.0; @@ -672,10 +691,10 @@ static double slow2(double x) { s = y*xx*(sn3 +xx*sn5); c = y*del+xx*(cs2 +xx*(cs4 + xx*cs6)); k=u.i[LOW_HALF]<<2; - sn=sincos.x[k]; - ssn=sincos.x[k+1]; - cs=sincos.x[k+2]; - ccs=sincos.x[k+3]; + sn=__sincostab.x[k]; + ssn=__sincostab.x[k+1]; + cs=__sincostab.x[k+2]; + ccs=__sincostab.x[k+3]; y1 = (y+t22)-t22; y2 = (y - y1)+del; e1 = (sn+t22)-t22; @@ -703,7 +722,9 @@ static double slow2(double x) { /* result.And if result not accurate enough routine calls mpsin1 or dubsin */ /***************************************************************************/ -static double sloww(double x,double dx, double orig) { +static double +SECTION +sloww(double x,double dx, double orig) { static const double th2_36 = 206158430208.0; /* 1.5*2**37 */ double y,x1,x2,xx,r,t,res,cor,w[2],a,da,xn; union {int4 i[2]; double x;} v; @@ -750,7 +771,9 @@ static double sloww(double x,double dx, double orig) { /* accurate enough routine calls mpsin1 or dubsin */ /***************************************************************************/ -static double sloww1(double x, double dx, double orig) { +static double +SECTION +sloww1(double x, double dx, double orig) { mynumber u; double sn,ssn,cs,ccs,s,c,w[2],y,y1,y2,c1,c2,xx,cor,res; static const double t22 = 6291456.0; @@ -763,10 +786,10 @@ static double sloww1(double x, double dx, double orig) { s = y*xx*(sn3 +xx*sn5); c = xx*(cs2 +xx*(cs4 + xx*cs6)); k=u.i[LOW_HALF]<<2; - sn=sincos.x[k]; - ssn=sincos.x[k+1]; - cs=sincos.x[k+2]; - ccs=sincos.x[k+3]; + sn=__sincostab.x[k]; + ssn=__sincostab.x[k+1]; + cs=__sincostab.x[k+2]; + ccs=__sincostab.x[k+3]; y1 = (y+t22)-t22; y2 = (y - y1)+dx; c1 = (cs+t22)-t22; @@ -792,7 +815,9 @@ static double sloww1(double x, double dx, double orig) { /* accurate enough routine calls mpsin1 or dubsin */ /***************************************************************************/ -static double sloww2(double x, double dx, double orig, int n) { +static double +SECTION +sloww2(double x, double dx, double orig, int n) { mynumber u; double sn,ssn,cs,ccs,s,c,w[2],y,y1,y2,e1,e2,xx,cor,res; static const double t22 = 6291456.0; @@ -805,10 +830,10 @@ static double sloww2(double x, double dx, double orig, int n) { s = y*xx*(sn3 +xx*sn5); c = y*dx+xx*(cs2 +xx*(cs4 + xx*cs6)); k=u.i[LOW_HALF]<<2; - sn=sincos.x[k]; - ssn=sincos.x[k+1]; - cs=sincos.x[k+2]; - ccs=sincos.x[k+3]; + sn=__sincostab.x[k]; + ssn=__sincostab.x[k+1]; + cs=__sincostab.x[k+2]; + ccs=__sincostab.x[k+3]; y1 = (y+t22)-t22; y2 = (y - y1)+dx; @@ -836,7 +861,9 @@ static double sloww2(double x, double dx, double orig, int n) { /* result.And if result not accurate enough routine calls other routines */ /***************************************************************************/ -static double bsloww(double x,double dx, double orig,int n) { +static double +SECTION +bsloww(double x,double dx, double orig,int n) { static const double th2_36 = 206158430208.0; /* 1.5*2**37 */ double y,x1,x2,xx,r,t,res,cor,w[2]; #if 0 @@ -869,7 +896,9 @@ static double bsloww(double x,double dx, double orig,int n) { /* And if result not accurate enough routine calls other routines */ /***************************************************************************/ -static double bsloww1(double x, double dx, double orig,int n) { +static double +SECTION +bsloww1(double x, double dx, double orig,int n) { mynumber u; double sn,ssn,cs,ccs,s,c,w[2],y,y1,y2,c1,c2,xx,cor,res; static const double t22 = 6291456.0; @@ -882,10 +911,10 @@ mynumber u; s = y*xx*(sn3 +xx*sn5); c = xx*(cs2 +xx*(cs4 + xx*cs6)); k=u.i[LOW_HALF]<<2; - sn=sincos.x[k]; - ssn=sincos.x[k+1]; - cs=sincos.x[k+2]; - ccs=sincos.x[k+3]; + sn=__sincostab.x[k]; + ssn=__sincostab.x[k+1]; + cs=__sincostab.x[k+2]; + ccs=__sincostab.x[k+3]; y1 = (y+t22)-t22; y2 = (y - y1)+dx; c1 = (cs+t22)-t22; @@ -912,7 +941,9 @@ mynumber u; /* And if result not accurate enough routine calls other routines */ /***************************************************************************/ -static double bsloww2(double x, double dx, double orig, int n) { +static double +SECTION +bsloww2(double x, double dx, double orig, int n) { mynumber u; double sn,ssn,cs,ccs,s,c,w[2],y,y1,y2,e1,e2,xx,cor,res; static const double t22 = 6291456.0; @@ -925,10 +956,10 @@ mynumber u; s = y*xx*(sn3 +xx*sn5); c = y*dx+xx*(cs2 +xx*(cs4 + xx*cs6)); k=u.i[LOW_HALF]<<2; - sn=sincos.x[k]; - ssn=sincos.x[k+1]; - cs=sincos.x[k+2]; - ccs=sincos.x[k+3]; + sn=__sincostab.x[k]; + ssn=__sincostab.x[k+1]; + cs=__sincostab.x[k+2]; + ccs=__sincostab.x[k+3]; y1 = (y+t22)-t22; y2 = (y - y1)+dx; @@ -954,7 +985,9 @@ mynumber u; /* precision and if still doesn't accurate enough by mpcos or docos */ /************************************************************************/ -static double cslow2(double x) { +static double +SECTION +cslow2(double x) { mynumber u; double sn,ssn,cs,ccs,s,c,w[2],y,y1,y2,e1,e2,xx,cor,res; static const double t22 = 6291456.0; @@ -966,10 +999,10 @@ static double cslow2(double x) { s = y*xx*(sn3 +xx*sn5); c = xx*(cs2 +xx*(cs4 + xx*cs6)); k=u.i[LOW_HALF]<<2; - sn=sincos.x[k]; - ssn=sincos.x[k+1]; - cs=sincos.x[k+2]; - ccs=sincos.x[k+3]; + sn=__sincostab.x[k]; + ssn=__sincostab.x[k+1]; + cs=__sincostab.x[k+2]; + ccs=__sincostab.x[k+3]; y1 = (y+t22)-t22; y2 = y - y1; e1 = (sn+t22)-t22; @@ -997,7 +1030,9 @@ static double cslow2(double x) { /***************************************************************************/ -static double csloww(double x,double dx, double orig) { +static double +SECTION +csloww(double x,double dx, double orig) { static const double th2_36 = 206158430208.0; /* 1.5*2**37 */ double y,x1,x2,xx,r,t,res,cor,w[2],a,da,xn; union {int4 i[2]; double x;} v; @@ -1046,7 +1081,9 @@ static double csloww(double x,double dx, double orig) { /* accurate enough routine calls other routines */ /***************************************************************************/ -static double csloww1(double x, double dx, double orig) { +static double +SECTION +csloww1(double x, double dx, double orig) { mynumber u; double sn,ssn,cs,ccs,s,c,w[2],y,y1,y2,c1,c2,xx,cor,res; static const double t22 = 6291456.0; @@ -1059,10 +1096,10 @@ static double csloww1(double x, double dx, double orig) { s = y*xx*(sn3 +xx*sn5); c = xx*(cs2 +xx*(cs4 + xx*cs6)); k=u.i[LOW_HALF]<<2; - sn=sincos.x[k]; - ssn=sincos.x[k+1]; - cs=sincos.x[k+2]; - ccs=sincos.x[k+3]; + sn=__sincostab.x[k]; + ssn=__sincostab.x[k+1]; + cs=__sincostab.x[k+2]; + ccs=__sincostab.x[k+3]; y1 = (y+t22)-t22; y2 = (y - y1)+dx; c1 = (cs+t22)-t22; @@ -1090,7 +1127,9 @@ static double csloww1(double x, double dx, double orig) { /* accurate enough routine calls other routines */ /***************************************************************************/ -static double csloww2(double x, double dx, double orig, int n) { +static double +SECTION +csloww2(double x, double dx, double orig, int n) { mynumber u; double sn,ssn,cs,ccs,s,c,w[2],y,y1,y2,e1,e2,xx,cor,res; static const double t22 = 6291456.0; @@ -1103,10 +1142,10 @@ static double csloww2(double x, double dx, double orig, int n) { s = y*xx*(sn3 +xx*sn5); c = y*dx+xx*(cs2 +xx*(cs4 + xx*cs6)); k=u.i[LOW_HALF]<<2; - sn=sincos.x[k]; - ssn=sincos.x[k+1]; - cs=sincos.x[k+2]; - ccs=sincos.x[k+3]; + sn=__sincostab.x[k]; + ssn=__sincostab.x[k+1]; + cs=__sincostab.x[k+2]; + ccs=__sincostab.x[k+3]; y1 = (y+t22)-t22; y2 = (y - y1)+dx; @@ -1127,12 +1166,17 @@ static double csloww2(double x, double dx, double orig, int n) { } } +#ifndef __cos weak_alias (__cos, cos) +# ifdef NO_LONG_DOUBLE +strong_alias (__cos, __cosl) +weak_alias (__cos, cosl) +# endif +#endif +#ifndef __sin weak_alias (__sin, sin) - -#ifdef NO_LONG_DOUBLE +# ifdef NO_LONG_DOUBLE strong_alias (__sin, __sinl) weak_alias (__sin, sinl) -strong_alias (__cos, __cosl) -weak_alias (__cos, cosl) +# endif #endif diff --git a/libc/sysdeps/ieee754/dbl-64/s_tan.c b/libc/sysdeps/ieee754/dbl-64/s_tan.c index df8eedd92..f0fcd677a 100644 --- a/libc/sysdeps/ieee754/dbl-64/s_tan.c +++ b/libc/sysdeps/ieee754/dbl-64/s_tan.c @@ -41,17 +41,23 @@ #include "MathLib.h" #include "math.h" +#ifndef SECTION +# define SECTION +#endif + static double tanMp(double); void __mptan(double, mp_no *, int); -double tan(double x) { +double +SECTION +tan(double x) { #include "utan.h" #include "utan.tbl" int ux,i,n; double a,da,a2,b,db,c,dc,c1,cc1,c2,cc2,c3,cc3,fi,ffi,gi,pz,s,sy, t,t1,t2,t3,t4,t7,t8,t9,t10,w,x2,xn,xx2,y,ya,yya,z0,z,zz,z2,zz2; -#ifndef DLA_FMA +#ifndef DLA_FMS double t5,t6; #endif int p; @@ -486,7 +492,9 @@ double tan(double x) { /* multiple precision stage */ /* Convert x to multi precision number,compute tan(x) by mptan() routine */ /* and converts result back to double */ -static double tanMp(double x) +static double +SECTION +tanMp(double x) { int p; double y; diff --git a/libc/sysdeps/ieee754/dbl-64/sincos.tbl b/libc/sysdeps/ieee754/dbl-64/sincos.tbl deleted file mode 100644 index 9343f2416..000000000 --- a/libc/sysdeps/ieee754/dbl-64/sincos.tbl +++ /dev/null @@ -1,912 +0,0 @@ -/* - * IBM Accurate Mathematical Library - * Written by International Business Machines Corp. - * Copyright (C) 2001, 2007 Free Software Foundation, Inc. - * - * This program 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. - * - * This program 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 this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/****************************************************************/ -/* TABLES FOR THE usin() and ucos() FUNCTION */ -/****************************************************************/ - - -#ifdef BIG_ENDI -static const union {int4 i[880]; double x[440];}sincos = { .i = { -/**/ 0x00000000, 0x00000000, -/**/ 0x00000000, 0x00000000, -/**/ 0x3FF00000, 0x00000000, -/**/ 0x00000000, 0x00000000, -/**/ 0x3F7FFFEA, 0xAAAEEEEF, -/**/ 0xBC1E45E2, 0xEC67B77C, -/**/ 0x3FEFFFC0, 0x00155552, -/**/ 0x3C8F4A01, 0xA0196DAE, -/**/ 0x3F8FFFAA, 0xAAEEEED5, -/**/ 0xBC02AB63, 0x9A9F0777, -/**/ 0x3FEFFF00, 0x0155549F, -/**/ 0x3C828A28, 0xA03A5EF3, -/**/ 0x3F97FF70, 0x01033255, -/**/ 0x3BFEFE2B, 0x51527336, -/**/ 0x3FEFFDC0, 0x06BFF7E6, -/**/ 0x3C8AE6DA, 0xE86977BD, -/**/ 0x3F9FFEAA, 0xAEEEE86F, -/**/ 0xBC3CD406, 0xFB224AE2, -/**/ 0x3FEFFC00, 0x155527D3, -/**/ 0xBC83B544, 0x92D89B5B, -/**/ 0x3FA3FEB2, 0xB12D45D5, -/**/ 0x3C34EC54, 0x203D1C11, -/**/ 0x3FEFF9C0, 0x3414A7BA, -/**/ 0x3C6991F4, 0xBE6C59BF, -/**/ 0x3FA7FDC0, 0x1032FBA9, -/**/ 0xBC4599BD, 0xF46E997A, -/**/ 0x3FEFF700, 0x6BFDF99F, -/**/ 0xBC78B3B5, 0x60648D5F, -/**/ 0x3FABFC6D, 0x78586DAC, -/**/ 0x3C18E4FD, 0x03DBF236, -/**/ 0x3FEFF3C0, 0xC8103A31, -/**/ 0x3C74856D, 0xBDDC0E66, -/**/ 0x3FAFFAAA, 0xEEED4EDB, -/**/ 0xBC42D16D, 0x32684B69, -/**/ 0x3FEFF001, 0x5549F4D3, -/**/ 0x3C832838, 0x7B99426F, -/**/ 0x3FB1FC34, 0x3D808BEF, -/**/ 0xBC5F3D32, 0xE6F3BE4F, -/**/ 0x3FEFEBC2, 0x22A8EF9F, -/**/ 0x3C579349, 0x34F54C77, -/**/ 0x3FB3FACB, 0x12D1755B, -/**/ 0xBC592191, 0x5299468C, -/**/ 0x3FEFE703, 0x4129EF6F, -/**/ 0xBC6CBF43, 0x37C96F97, -/**/ 0x3FB5F911, 0xFD10B737, -/**/ 0xBC50184F, 0x02BE9102, -/**/ 0x3FEFE1C4, 0xC3C873EB, -/**/ 0xBC35A9C9, 0x057C4A02, -/**/ 0x3FB7F701, 0x032550E4, -/**/ 0x3C3AFC2D, 0x1800501A, -/**/ 0x3FEFDC06, 0xBF7E6B9B, -/**/ 0x3C831902, 0xB535F8DB, -/**/ 0x3FB9F490, 0x2D55D1F9, -/**/ 0x3C52696D, 0x7EAC1DC1, -/**/ 0x3FEFD5C9, 0x4B43E000, -/**/ 0xBC62E768, 0xCB4F92F9, -/**/ 0x3FBBF1B7, 0x8568391D, -/**/ 0x3C5E9184, 0x1DEA4CC8, -/**/ 0x3FEFCF0C, 0x800E99B1, -/**/ 0x3C6EA3D7, 0x86D186AC, -/**/ 0x3FBDEE6F, 0x16C1CCE6, -/**/ 0xBC450F8E, 0x2FB71673, -/**/ 0x3FEFC7D0, 0x78D1BC88, -/**/ 0x3C8075D2, 0x447DB685, -/**/ 0x3FBFEAAE, 0xEE86EE36, -/**/ 0xBC4AFCB2, 0xBCC6F03B, -/**/ 0x3FEFC015, 0x527D5BD3, -/**/ 0x3C8B68F3, 0x5094EFB8, -/**/ 0x3FC0F337, 0x8DDD71D1, -/**/ 0x3C6D8468, 0x724F0F9E, -/**/ 0x3FEFB7DB, 0x2BFE0695, -/**/ 0x3C821DAD, 0xF4F65AB1, -/**/ 0x3FC1F0D3, 0xD7AFCEAF, -/**/ 0xBC66EF95, 0x099769A5, -/**/ 0x3FEFAF22, 0x263C4BD3, -/**/ 0xBC552ACE, 0x133A2769, -/**/ 0x3FC2EE28, 0x5E4AB88F, -/**/ 0xBC6E4D0F, 0x05DEE058, -/**/ 0x3FEFA5EA, 0x641C36F2, -/**/ 0x3C404DA6, 0xED17CC7C, -/**/ 0x3FC3EB31, 0x2C5D66CB, -/**/ 0x3C647D66, 0x6B66CB91, -/**/ 0x3FEF9C34, 0x0A7CC428, -/**/ 0x3C8C5B6B, 0x063B7462, -/**/ 0x3FC4E7EA, 0x4DC5F27B, -/**/ 0x3C5949DB, 0x2AC072FC, -/**/ 0x3FEF91FF, 0x40374D01, -/**/ 0xBC67D03F, 0x4D3A9E4C, -/**/ 0x3FC5E44F, 0xCFA126F3, -/**/ 0xBC66F443, 0x063F89B6, -/**/ 0x3FEF874C, 0x2E1EECF6, -/**/ 0xBC8C6514, 0xE1332B16, -/**/ 0x3FC6E05D, 0xC05A4D4C, -/**/ 0xBBD32C5C, 0x8B81C940, -/**/ 0x3FEF7C1A, 0xFEFFDE24, -/**/ 0xBC78F55B, 0xC47540B1, -/**/ 0x3FC7DC10, 0x2FBAF2B5, -/**/ 0x3C45AB50, 0xE23C97C3, -/**/ 0x3FEF706B, 0xDF9ECE1C, -/**/ 0xBC8698C8, 0x0C36DCB4, -/**/ 0x3FC8D763, 0x2EFAA944, -/**/ 0xBC620FA2, 0x62CBB953, -/**/ 0x3FEF643E, 0xFEB82ACD, -/**/ 0x3C76B00A, 0xC1FE28AC, -/**/ 0x3FC9D252, 0xD0CEC312, -/**/ 0x3C59C43D, 0x80B1137D, -/**/ 0x3FEF5794, 0x8CFF6797, -/**/ 0x3C6E3A0D, 0x3E03B1D5, -/**/ 0x3FCACCDB, 0x297A0765, -/**/ 0xBC59883B, 0x57D6CDEB, -/**/ 0x3FEF4A6C, 0xBD1E3A79, -/**/ 0x3C813DF0, 0xEDAEBB57, -/**/ 0x3FCBC6F8, 0x4EDC6199, -/**/ 0x3C69C1A5, 0x6A7B0CAB, -/**/ 0x3FEF3CC7, 0xC3B3D16E, -/**/ 0xBC621A3A, 0xD28A3494, -/**/ 0x3FCCC0A6, 0x588289A3, -/**/ 0xBC6868D0, 0x9BC87C6B, -/**/ 0x3FEF2EA5, 0xD753FFED, -/**/ 0x3C8CC421, 0x5F56D583, -/**/ 0x3FCDB9E1, 0x5FB5A5D0, -/**/ 0xBC632E20, 0xD6CC6FC2, -/**/ 0x3FEF2007, 0x3086649F, -/**/ 0x3C7B9404, 0x16C1984B, -/**/ 0x3FCEB2A5, 0x7F8AE5A3, -/**/ 0xBC60BE06, 0xAF572CEB, -/**/ 0x3FEF10EC, 0x09C5873B, -/**/ 0x3C8D9072, 0x762C1283, -/**/ 0x3FCFAAEE, 0xD4F31577, -/**/ 0xBC615D88, 0x508E32B8, -/**/ 0x3FEF0154, 0x9F7DEEA1, -/**/ 0x3C8D3C1E, 0x99E5CAFD, -/**/ 0x3FD0515C, 0xBF65155C, -/**/ 0xBC79B8C2, 0x9DFD8EC8, -/**/ 0x3FEEF141, 0x300D2F26, -/**/ 0xBC82AA1B, 0x08DED372, -/**/ 0x3FD0CD00, 0xCEF36436, -/**/ 0xBC79FB0A, 0x0C93E2B5, -/**/ 0x3FEEE0B1, 0xFBC0F11C, -/**/ 0xBC4BFD23, 0x80BBC3B1, -/**/ 0x3FD14861, 0xAA94DDEB, -/**/ 0xBC6BE881, 0xB5B615A4, -/**/ 0x3FEECFA7, 0x44D5EFA1, -/**/ 0xBC556D0A, 0x4AF541D0, -/**/ 0x3FD1C37D, 0x64C6B876, -/**/ 0x3C746076, 0xFE0DCFF5, -/**/ 0x3FEEBE21, 0x4F76EFA8, -/**/ 0xBC802F9F, 0x12BA543E, -/**/ 0x3FD23E52, 0x111AAF36, -/**/ 0xBC74F080, 0x334EFF18, -/**/ 0x3FEEAC20, 0x61BBAF4F, -/**/ 0x3C62C1D5, 0x3E94658D, -/**/ 0x3FD2B8DD, 0xC43EB49F, -/**/ 0x3C615538, 0x99F2D807, -/**/ 0x3FEE99A4, 0xC3A7CD83, -/**/ 0xBC82264B, 0x1BC53CE8, -/**/ 0x3FD3331E, 0x94049F87, -/**/ 0x3C7E0CB6, 0xB40C302C, -/**/ 0x3FEE86AE, 0xBF29A9ED, -/**/ 0x3C89397A, 0xFDBB58A7, -/**/ 0x3FD3AD12, 0x9769D3D8, -/**/ 0x3C003D55, 0x04878398, -/**/ 0x3FEE733E, 0xA0193D40, -/**/ 0xBC86428B, 0x3546CE13, -/**/ 0x3FD426B7, 0xE69EE697, -/**/ 0xBC7F09C7, 0x5705C59F, -/**/ 0x3FEE5F54, 0xB436E9D0, -/**/ 0x3C87EB0F, 0xD02FC8BC, -/**/ 0x3FD4A00C, 0x9B0F3D20, -/**/ 0x3C7823BA, 0x6BB08EAD, -/**/ 0x3FEE4AF1, 0x4B2A449C, -/**/ 0xBC868CA0, 0x2E8A6833, -/**/ 0x3FD5190E, 0xCF68A77A, -/**/ 0x3C7B3571, 0x55EEF0F3, -/**/ 0x3FEE3614, 0xB680D6A5, -/**/ 0xBC727793, 0xAA015237, -/**/ 0x3FD591BC, 0x9FA2F597, -/**/ 0x3C67C74B, 0xAC3FE0CB, -/**/ 0x3FEE20BF, 0x49ACD6C1, -/**/ 0xBC5660AE, 0xC7EF636C, -/**/ 0x3FD60A14, 0x29078775, -/**/ 0x3C5B1FD8, 0x0BA89133, -/**/ 0x3FEE0AF1, 0x5A03DBCE, -/**/ 0x3C5FE8E7, 0x02771AE6, -/**/ 0x3FD68213, 0x8A38D7F7, -/**/ 0xBC7D8892, 0x02444AAD, -/**/ 0x3FEDF4AB, 0x3EBD875E, -/**/ 0xBC8E2D8A, 0x7E6736C4, -/**/ 0x3FD6F9B8, 0xE33A0255, -/**/ 0x3C742BC1, 0x4EE9DA0D, -/**/ 0x3FEDDDED, 0x50F228D6, -/**/ 0xBC6E80C8, 0xD42BA2BF, -/**/ 0x3FD77102, 0x55764214, -/**/ 0xBC66EAD7, 0x314BB6CE, -/**/ 0x3FEDC6B7, 0xEB995912, -/**/ 0x3C54B364, 0x776DCD35, -/**/ 0x3FD7E7EE, 0x03C86D4E, -/**/ 0xBC7B63BC, 0xDABF5AF2, -/**/ 0x3FEDAF0B, 0x6B888E83, -/**/ 0x3C8A249E, 0x2B5E5CEA, -/**/ 0x3FD85E7A, 0x12826949, -/**/ 0x3C78A40E, 0x9B5FACE0, -/**/ 0x3FED96E8, 0x2F71A9DC, -/**/ 0x3C8FF61B, 0xD5D2039D, -/**/ 0x3FD8D4A4, 0xA774992F, -/**/ 0x3C744A02, 0xEA766326, -/**/ 0x3FED7E4E, 0x97E17B4A, -/**/ 0xBC63B770, 0x352BED94, -/**/ 0x3FD94A6B, 0xE9F546C5, -/**/ 0xBC769CE1, 0x3E683F58, -/**/ 0x3FED653F, 0x073E4040, -/**/ 0xBC876236, 0x434BEC37, -/**/ 0x3FD9BFCE, 0x02E80510, -/**/ 0x3C709E39, 0xA320B0A4, -/**/ 0x3FED4BB9, 0xE1C619E0, -/**/ 0x3C8F34BB, 0x77858F61, -/**/ 0x3FDA34C9, 0x1CC50CCA, -/**/ 0xBC5A310E, 0x3B50CECD, -/**/ 0x3FED31BF, 0x8D8D7C06, -/**/ 0x3C7E60DD, 0x3089CBDD, -/**/ 0x3FDAA95B, 0x63A09277, -/**/ 0xBC66293E, 0xB13C0381, -/**/ 0x3FED1750, 0x727D94F0, -/**/ 0x3C80D52B, 0x1EC1A48E, -/**/ 0x3FDB1D83, 0x05321617, -/**/ 0xBC7AE242, 0xCB99F519, -/**/ 0x3FECFC6C, 0xFA52AD9F, -/**/ 0x3C88B5B5, 0x508F2A0D, -/**/ 0x3FDB913E, 0x30DBAC43, -/**/ 0xBC7E38AD, 0x2F6C3FF1, -/**/ 0x3FECE115, 0x909A82E5, -/**/ 0x3C81F139, 0xBB31109A, -/**/ 0x3FDC048B, 0x17B140A3, -/**/ 0x3C619FE6, 0x757E9FA7, -/**/ 0x3FECC54A, 0xA2B2972E, -/**/ 0x3C64EE16, 0x2BA83A98, -/**/ 0x3FDC7767, 0xEC7FD19E, -/**/ 0xBC5EB14D, 0x1A3D5826, -/**/ 0x3FECA90C, 0x9FC67D0B, -/**/ 0xBC646A81, 0x485E3462, -/**/ 0x3FDCE9D2, 0xE3D4A51F, -/**/ 0xBC62FC8A, 0x12DAE298, -/**/ 0x3FEC8C5B, 0xF8CE1A84, -/**/ 0x3C7AB3D1, 0xA1590123, -/**/ 0x3FDD5BCA, 0x34047661, -/**/ 0x3C728A44, 0xA75FC29C, -/**/ 0x3FEC6F39, 0x208BE53B, -/**/ 0xBC8741DB, 0xFBAADB42, -/**/ 0x3FDDCD4C, 0x15329C9A, -/**/ 0x3C70D4C6, 0xE171FD9A, -/**/ 0x3FEC51A4, 0x8B8B175E, -/**/ 0xBC61BBB4, 0x3B9AA880, -/**/ 0x3FDE3E56, 0xC1582A69, -/**/ 0xBC50A482, 0x1099F88F, -/**/ 0x3FEC339E, 0xB01DDD81, -/**/ 0xBC8CAAF5, 0xEE82C5C0, -/**/ 0x3FDEAEE8, 0x744B05F0, -/**/ 0xBC5789B4, 0x3C9B027D, -/**/ 0x3FEC1528, 0x065B7D50, -/**/ 0xBC889211, 0x1312E828, -/**/ 0x3FDF1EFF, 0x6BC4F97B, -/**/ 0x3C717212, 0xF8A7525C, -/**/ 0x3FEBF641, 0x081E7536, -/**/ 0x3C8B7BD7, 0x1628A9A1, -/**/ 0x3FDF8E99, 0xE76ABC97, -/**/ 0x3C59D950, 0xAF2D00A3, -/**/ 0x3FEBD6EA, 0x310294F5, -/**/ 0x3C731BBC, 0xC88C109D, -/**/ 0x3FDFFDB6, 0x28D2F57A, -/**/ 0x3C6F4A99, 0x2E905B6A, -/**/ 0x3FEBB723, 0xFE630F32, -/**/ 0x3C772BD2, 0x452D0A39, -/**/ 0x3FE03629, 0x39C69955, -/**/ 0xBC82D8CD, 0x78397B01, -/**/ 0x3FEB96EE, 0xEF58840E, -/**/ 0x3C545A3C, 0xC78FADE0, -/**/ 0x3FE06D36, 0x86946E5B, -/**/ 0x3C83F5AE, 0x4538FF1B, -/**/ 0x3FEB764B, 0x84B704C2, -/**/ 0xBC8F5848, 0xC21B389B, -/**/ 0x3FE0A402, 0x1E9E1001, -/**/ 0xBC86F643, 0xA13914F6, -/**/ 0x3FEB553A, 0x410C104E, -/**/ 0x3C58FF79, 0x47027A16, -/**/ 0x3FE0DA8B, 0x26B5672E, -/**/ 0xBC8A58DE, 0xF0BEE909, -/**/ 0x3FEB33BB, 0xA89C8948, -/**/ 0x3C8EA6A5, 0x1D1F6CA9, -/**/ 0x3FE110D0, 0xC4B69C3B, -/**/ 0x3C8D9189, 0x98809981, -/**/ 0x3FEB11D0, 0x4162A4C6, -/**/ 0x3C71DD56, 0x1EFBC0C2, -/**/ 0x3FE146D2, 0x1F8B7F82, -/**/ 0x3C7BF953, 0x5E2739A8, -/**/ 0x3FEAEF78, 0x930BD275, -/**/ 0xBC7F8362, 0x79746F94, -/**/ 0x3FE17C8E, 0x5F2EEDB0, -/**/ 0x3C635E57, 0x102E2488, -/**/ 0x3FEACCB5, 0x26F69DE5, -/**/ 0x3C88FB6A, 0x8DD6B6CC, -/**/ 0x3FE1B204, 0xACB02FDD, -/**/ 0xBC5F190C, 0x70CBB5FF, -/**/ 0x3FEAA986, 0x88308913, -/**/ 0xBC0B83D6, 0x07CD5070, -/**/ 0x3FE1E734, 0x3236574C, -/**/ 0x3C722A3F, 0xA4F41D5A, -/**/ 0x3FEA85ED, 0x4373E02D, -/**/ 0x3C69BE06, 0x385EC792, -/**/ 0x3FE21C1C, 0x1B0394CF, -/**/ 0x3C5E5B32, 0x4B23AA31, -/**/ 0x3FEA61E9, 0xE72586AF, -/**/ 0x3C858330, 0xE2FD453F, -/**/ 0x3FE250BB, 0x93788BBB, -/**/ 0x3C7EA3D0, 0x2457BCCE, -/**/ 0x3FEA3D7D, 0x0352BDCF, -/**/ 0xBC868DBA, 0xECA19669, -/**/ 0x3FE28511, 0xC917A067, -/**/ 0xBC801DF1, 0xD9A16B70, -/**/ 0x3FEA18A7, 0x29AEE445, -/**/ 0x3C395E25, 0x736C0358, -/**/ 0x3FE2B91D, 0xEA88421E, -/**/ 0xBC8FA371, 0xDB216AB0, -/**/ 0x3FE9F368, 0xED912F85, -/**/ 0xBC81D200, 0xC5791606, -/**/ 0x3FE2ECDF, 0x279A3082, -/**/ 0x3C8D3557, 0xE0E7E37E, -/**/ 0x3FE9CDC2, 0xE3F25E5C, -/**/ 0x3C83F991, 0x12993F62, -/**/ 0x3FE32054, 0xB148BC4F, -/**/ 0x3C8F6B42, 0x095A135B, -/**/ 0x3FE9A7B5, 0xA36A6514, -/**/ 0x3C8722CF, 0xCC9FA7A9, -/**/ 0x3FE3537D, 0xB9BE0367, -/**/ 0x3C6B327E, 0x7AF040F0, -/**/ 0x3FE98141, 0xC42E1310, -/**/ 0x3C8D1FF8, 0x0488F08D, -/**/ 0x3FE38659, 0x7456282B, -/**/ 0xBC710FAD, 0xA93B07A8, -/**/ 0x3FE95A67, 0xE00CB1FD, -/**/ 0xBC80BEFD, 0xA21F862D, -/**/ 0x3FE3B8E7, 0x15A2840A, -/**/ 0xBC797653, 0xA7D2F07B, -/**/ 0x3FE93328, 0x926D9E92, -/**/ 0xBC8BB770, 0x03600CDA, -/**/ 0x3FE3EB25, 0xD36CD53A, -/**/ 0xBC5BE570, 0xE1570FC0, -/**/ 0x3FE90B84, 0x784DDAF7, -/**/ 0xBC70FEB1, 0x0AB93B87, -/**/ 0x3FE41D14, 0xE4BA6790, -/**/ 0x3C84608F, 0xD287ECF5, -/**/ 0x3FE8E37C, 0x303D9AD1, -/**/ 0xBC6463A4, 0xB53D4BF8, -/**/ 0x3FE44EB3, 0x81CF386B, -/**/ 0xBC83ED6C, 0x1E6A5505, -/**/ 0x3FE8BB10, 0x5A5DC900, -/**/ 0x3C8863E0, 0x3E9474C1, -/**/ 0x3FE48000, 0xE431159F, -/**/ 0xBC8B194A, 0x7463ED10, -/**/ 0x3FE89241, 0x985D871F, -/**/ 0x3C8C48D9, 0xC413ED84, -/**/ 0x3FE4B0FC, 0x46AAB761, -/**/ 0x3C20DA05, 0x738CC59A, -/**/ 0x3FE86910, 0x8D77A6C6, -/**/ 0x3C7338FF, 0xE2BFE9DD, -/**/ 0x3FE4E1A4, 0xE54ED51B, -/**/ 0xBC8A492F, 0x89B7C76A, -/**/ 0x3FE83F7D, 0xDE701CA0, -/**/ 0xBC4152CF, 0x609BC6E8, -/**/ 0x3FE511F9, 0xFD7B351C, -/**/ 0xBC85C0E8, 0x61C48831, -/**/ 0x3FE8158A, 0x31916D5D, -/**/ 0xBC6DE8B9, 0x0B8228DE, -/**/ 0x3FE541FA, 0xCDDBB724, -/**/ 0x3C7232C2, 0x8520D391, -/**/ 0x3FE7EB36, 0x2EAA1488, -/**/ 0x3C5A1D65, 0xA4A5959F, -/**/ 0x3FE571A6, 0x966D59B3, -/**/ 0x3C5C843B, 0x4D0FB198, -/**/ 0x3FE7C082, 0x7F09E54F, -/**/ 0xBC6C73D6, 0xD72AEE68, -/**/ 0x3FE5A0FC, 0x98813A12, -/**/ 0xBC8D82E2, 0xB7D4227B, -/**/ 0x3FE7956F, 0xCD7F6543, -/**/ 0xBC8AB276, 0xE9D45AE4, -/**/ 0x3FE5CFFC, 0x16BF8F0D, -/**/ 0x3C896CB3, 0x70EB578A, -/**/ 0x3FE769FE, 0xC655211F, -/**/ 0xBC6827D5, 0xCF8C68C5, -/**/ 0x3FE5FEA4, 0x552A9E57, -/**/ 0x3C80B6CE, 0xF7EE20B7, -/**/ 0x3FE73E30, 0x174EFBA1, -/**/ 0xBC65D3AE, 0x3D94AD5F, -/**/ 0x3FE62CF4, 0x9921AC79, -/**/ 0xBC8EDD98, 0x55B6241A, -/**/ 0x3FE71204, 0x6FA77678, -/**/ 0x3C8425B0, 0xA5029C81, -/**/ 0x3FE65AEC, 0x2963E755, -/**/ 0x3C8126F9, 0x6B71053C, -/**/ 0x3FE6E57C, 0x800CF55E, -/**/ 0x3C860286, 0xDEDBD0A6, -/**/ 0x3FE6888A, 0x4E134B2F, -/**/ 0xBC86B7D3, 0x7644D5E6, -/**/ 0x3FE6B898, 0xFA9EFB5D, -/**/ 0x3C715AC7, 0x86CCF4B2, -/**/ 0x3FE6B5CE, 0x50B7821A, -/**/ 0xBC65D515, 0x8F702E0F, -/**/ 0x3FE68B5A, 0x92EB6253, -/**/ 0xBC89A91A, 0xD985F89C, -/**/ 0x3FE6E2B7, 0x7C40BDE1, -/**/ 0xBC70E729, 0x857FAD53, -/**/ 0x3FE65DC1, 0xFDEB8CBA, -/**/ 0xBC597C1B, 0x47337C77, -/**/ 0x3FE70F45, 0x1D0A8C40, -/**/ 0x3C697EDE, 0x3885770D, -/**/ 0x3FE62FCF, 0xF20191C7, -/**/ 0x3C6D9143, 0x895756EF, -/**/ 0x3FE73B76, 0x80DEA578, -/**/ 0xBC722483, 0x06DC12A2, -/**/ 0x3FE60185, 0x26F563DF, -/**/ 0x3C846CA5, 0xE0E432D0, -/**/ 0x3FE7674A, 0xF6F7B524, -/**/ 0x3C7E9D3F, 0x94AC84A8, -/**/ 0x3FE5D2E2, 0x55F1F17A, -/**/ 0x3C803141, 0x04C8892B, -/**/ 0x3FE792C1, 0xD0041D52, -/**/ 0xBC8ABF05, 0xEEB354EB, -/**/ 0x3FE5A3E8, 0x39824077, -/**/ 0x3C8428AA, 0x2759BE62, -/**/ 0x3FE7BDDA, 0x5E28B3C2, -/**/ 0x3C4AD119, 0x7CCD0393, -/**/ 0x3FE57497, 0x8D8E83F2, -/**/ 0x3C8F4714, 0xAF282D23, -/**/ 0x3FE7E893, 0xF5037959, -/**/ 0x3C80EEFB, 0xAA650C4C, -/**/ 0x3FE544F1, 0x0F592CA5, -/**/ 0xBC8E7AE8, 0xE6C7A62F, -/**/ 0x3FE812ED, 0xE9AE4BA4, -/**/ 0xBC87830A, 0xDF402DDA, -/**/ 0x3FE514F5, 0x7D7BF3DA, -/**/ 0x3C747A10, 0x8073C259 } }; -#else -#ifdef LITTLE_ENDI -static const union {int4 i[880]; double x[440];} sincos = { .i = { -/**/ 0x00000000, 0x00000000, -/**/ 0x00000000, 0x00000000, -/**/ 0x00000000, 0x3FF00000, -/**/ 0x00000000, 0x00000000, -/**/ 0xAAAEEEEF, 0x3F7FFFEA, -/**/ 0xEC67B77C, 0xBC1E45E2, -/**/ 0x00155552, 0x3FEFFFC0, -/**/ 0xA0196DAE, 0x3C8F4A01, -/**/ 0xAAEEEED5, 0x3F8FFFAA, -/**/ 0x9A9F0777, 0xBC02AB63, -/**/ 0x0155549F, 0x3FEFFF00, -/**/ 0xA03A5EF3, 0x3C828A28, -/**/ 0x01033255, 0x3F97FF70, -/**/ 0x51527336, 0x3BFEFE2B, -/**/ 0x06BFF7E6, 0x3FEFFDC0, -/**/ 0xE86977BD, 0x3C8AE6DA, -/**/ 0xAEEEE86F, 0x3F9FFEAA, -/**/ 0xFB224AE2, 0xBC3CD406, -/**/ 0x155527D3, 0x3FEFFC00, -/**/ 0x92D89B5B, 0xBC83B544, -/**/ 0xB12D45D5, 0x3FA3FEB2, -/**/ 0x203D1C11, 0x3C34EC54, -/**/ 0x3414A7BA, 0x3FEFF9C0, -/**/ 0xBE6C59BF, 0x3C6991F4, -/**/ 0x1032FBA9, 0x3FA7FDC0, -/**/ 0xF46E997A, 0xBC4599BD, -/**/ 0x6BFDF99F, 0x3FEFF700, -/**/ 0x60648D5F, 0xBC78B3B5, -/**/ 0x78586DAC, 0x3FABFC6D, -/**/ 0x03DBF236, 0x3C18E4FD, -/**/ 0xC8103A31, 0x3FEFF3C0, -/**/ 0xBDDC0E66, 0x3C74856D, -/**/ 0xEEED4EDB, 0x3FAFFAAA, -/**/ 0x32684B69, 0xBC42D16D, -/**/ 0x5549F4D3, 0x3FEFF001, -/**/ 0x7B99426F, 0x3C832838, -/**/ 0x3D808BEF, 0x3FB1FC34, -/**/ 0xE6F3BE4F, 0xBC5F3D32, -/**/ 0x22A8EF9F, 0x3FEFEBC2, -/**/ 0x34F54C77, 0x3C579349, -/**/ 0x12D1755B, 0x3FB3FACB, -/**/ 0x5299468C, 0xBC592191, -/**/ 0x4129EF6F, 0x3FEFE703, -/**/ 0x37C96F97, 0xBC6CBF43, -/**/ 0xFD10B737, 0x3FB5F911, -/**/ 0x02BE9102, 0xBC50184F, -/**/ 0xC3C873EB, 0x3FEFE1C4, -/**/ 0x057C4A02, 0xBC35A9C9, -/**/ 0x032550E4, 0x3FB7F701, -/**/ 0x1800501A, 0x3C3AFC2D, -/**/ 0xBF7E6B9B, 0x3FEFDC06, -/**/ 0xB535F8DB, 0x3C831902, -/**/ 0x2D55D1F9, 0x3FB9F490, -/**/ 0x7EAC1DC1, 0x3C52696D, -/**/ 0x4B43E000, 0x3FEFD5C9, -/**/ 0xCB4F92F9, 0xBC62E768, -/**/ 0x8568391D, 0x3FBBF1B7, -/**/ 0x1DEA4CC8, 0x3C5E9184, -/**/ 0x800E99B1, 0x3FEFCF0C, -/**/ 0x86D186AC, 0x3C6EA3D7, -/**/ 0x16C1CCE6, 0x3FBDEE6F, -/**/ 0x2FB71673, 0xBC450F8E, -/**/ 0x78D1BC88, 0x3FEFC7D0, -/**/ 0x447DB685, 0x3C8075D2, -/**/ 0xEE86EE36, 0x3FBFEAAE, -/**/ 0xBCC6F03B, 0xBC4AFCB2, -/**/ 0x527D5BD3, 0x3FEFC015, -/**/ 0x5094EFB8, 0x3C8B68F3, -/**/ 0x8DDD71D1, 0x3FC0F337, -/**/ 0x724F0F9E, 0x3C6D8468, -/**/ 0x2BFE0695, 0x3FEFB7DB, -/**/ 0xF4F65AB1, 0x3C821DAD, -/**/ 0xD7AFCEAF, 0x3FC1F0D3, -/**/ 0x099769A5, 0xBC66EF95, -/**/ 0x263C4BD3, 0x3FEFAF22, -/**/ 0x133A2769, 0xBC552ACE, -/**/ 0x5E4AB88F, 0x3FC2EE28, -/**/ 0x05DEE058, 0xBC6E4D0F, -/**/ 0x641C36F2, 0x3FEFA5EA, -/**/ 0xED17CC7C, 0x3C404DA6, -/**/ 0x2C5D66CB, 0x3FC3EB31, -/**/ 0x6B66CB91, 0x3C647D66, -/**/ 0x0A7CC428, 0x3FEF9C34, -/**/ 0x063B7462, 0x3C8C5B6B, -/**/ 0x4DC5F27B, 0x3FC4E7EA, -/**/ 0x2AC072FC, 0x3C5949DB, -/**/ 0x40374D01, 0x3FEF91FF, -/**/ 0x4D3A9E4C, 0xBC67D03F, -/**/ 0xCFA126F3, 0x3FC5E44F, -/**/ 0x063F89B6, 0xBC66F443, -/**/ 0x2E1EECF6, 0x3FEF874C, -/**/ 0xE1332B16, 0xBC8C6514, -/**/ 0xC05A4D4C, 0x3FC6E05D, -/**/ 0x8B81C940, 0xBBD32C5C, -/**/ 0xFEFFDE24, 0x3FEF7C1A, -/**/ 0xC47540B1, 0xBC78F55B, -/**/ 0x2FBAF2B5, 0x3FC7DC10, -/**/ 0xE23C97C3, 0x3C45AB50, -/**/ 0xDF9ECE1C, 0x3FEF706B, -/**/ 0x0C36DCB4, 0xBC8698C8, -/**/ 0x2EFAA944, 0x3FC8D763, -/**/ 0x62CBB953, 0xBC620FA2, -/**/ 0xFEB82ACD, 0x3FEF643E, -/**/ 0xC1FE28AC, 0x3C76B00A, -/**/ 0xD0CEC312, 0x3FC9D252, -/**/ 0x80B1137D, 0x3C59C43D, -/**/ 0x8CFF6797, 0x3FEF5794, -/**/ 0x3E03B1D5, 0x3C6E3A0D, -/**/ 0x297A0765, 0x3FCACCDB, -/**/ 0x57D6CDEB, 0xBC59883B, -/**/ 0xBD1E3A79, 0x3FEF4A6C, -/**/ 0xEDAEBB57, 0x3C813DF0, -/**/ 0x4EDC6199, 0x3FCBC6F8, -/**/ 0x6A7B0CAB, 0x3C69C1A5, -/**/ 0xC3B3D16E, 0x3FEF3CC7, -/**/ 0xD28A3494, 0xBC621A3A, -/**/ 0x588289A3, 0x3FCCC0A6, -/**/ 0x9BC87C6B, 0xBC6868D0, -/**/ 0xD753FFED, 0x3FEF2EA5, -/**/ 0x5F56D583, 0x3C8CC421, -/**/ 0x5FB5A5D0, 0x3FCDB9E1, -/**/ 0xD6CC6FC2, 0xBC632E20, -/**/ 0x3086649F, 0x3FEF2007, -/**/ 0x16C1984B, 0x3C7B9404, -/**/ 0x7F8AE5A3, 0x3FCEB2A5, -/**/ 0xAF572CEB, 0xBC60BE06, -/**/ 0x09C5873B, 0x3FEF10EC, -/**/ 0x762C1283, 0x3C8D9072, -/**/ 0xD4F31577, 0x3FCFAAEE, -/**/ 0x508E32B8, 0xBC615D88, -/**/ 0x9F7DEEA1, 0x3FEF0154, -/**/ 0x99E5CAFD, 0x3C8D3C1E, -/**/ 0xBF65155C, 0x3FD0515C, -/**/ 0x9DFD8EC8, 0xBC79B8C2, -/**/ 0x300D2F26, 0x3FEEF141, -/**/ 0x08DED372, 0xBC82AA1B, -/**/ 0xCEF36436, 0x3FD0CD00, -/**/ 0x0C93E2B5, 0xBC79FB0A, -/**/ 0xFBC0F11C, 0x3FEEE0B1, -/**/ 0x80BBC3B1, 0xBC4BFD23, -/**/ 0xAA94DDEB, 0x3FD14861, -/**/ 0xB5B615A4, 0xBC6BE881, -/**/ 0x44D5EFA1, 0x3FEECFA7, -/**/ 0x4AF541D0, 0xBC556D0A, -/**/ 0x64C6B876, 0x3FD1C37D, -/**/ 0xFE0DCFF5, 0x3C746076, -/**/ 0x4F76EFA8, 0x3FEEBE21, -/**/ 0x12BA543E, 0xBC802F9F, -/**/ 0x111AAF36, 0x3FD23E52, -/**/ 0x334EFF18, 0xBC74F080, -/**/ 0x61BBAF4F, 0x3FEEAC20, -/**/ 0x3E94658D, 0x3C62C1D5, -/**/ 0xC43EB49F, 0x3FD2B8DD, -/**/ 0x99F2D807, 0x3C615538, -/**/ 0xC3A7CD83, 0x3FEE99A4, -/**/ 0x1BC53CE8, 0xBC82264B, -/**/ 0x94049F87, 0x3FD3331E, -/**/ 0xB40C302C, 0x3C7E0CB6, -/**/ 0xBF29A9ED, 0x3FEE86AE, -/**/ 0xFDBB58A7, 0x3C89397A, -/**/ 0x9769D3D8, 0x3FD3AD12, -/**/ 0x04878398, 0x3C003D55, -/**/ 0xA0193D40, 0x3FEE733E, -/**/ 0x3546CE13, 0xBC86428B, -/**/ 0xE69EE697, 0x3FD426B7, -/**/ 0x5705C59F, 0xBC7F09C7, -/**/ 0xB436E9D0, 0x3FEE5F54, -/**/ 0xD02FC8BC, 0x3C87EB0F, -/**/ 0x9B0F3D20, 0x3FD4A00C, -/**/ 0x6BB08EAD, 0x3C7823BA, -/**/ 0x4B2A449C, 0x3FEE4AF1, -/**/ 0x2E8A6833, 0xBC868CA0, -/**/ 0xCF68A77A, 0x3FD5190E, -/**/ 0x55EEF0F3, 0x3C7B3571, -/**/ 0xB680D6A5, 0x3FEE3614, -/**/ 0xAA015237, 0xBC727793, -/**/ 0x9FA2F597, 0x3FD591BC, -/**/ 0xAC3FE0CB, 0x3C67C74B, -/**/ 0x49ACD6C1, 0x3FEE20BF, -/**/ 0xC7EF636C, 0xBC5660AE, -/**/ 0x29078775, 0x3FD60A14, -/**/ 0x0BA89133, 0x3C5B1FD8, -/**/ 0x5A03DBCE, 0x3FEE0AF1, -/**/ 0x02771AE6, 0x3C5FE8E7, -/**/ 0x8A38D7F7, 0x3FD68213, -/**/ 0x02444AAD, 0xBC7D8892, -/**/ 0x3EBD875E, 0x3FEDF4AB, -/**/ 0x7E6736C4, 0xBC8E2D8A, -/**/ 0xE33A0255, 0x3FD6F9B8, -/**/ 0x4EE9DA0D, 0x3C742BC1, -/**/ 0x50F228D6, 0x3FEDDDED, -/**/ 0xD42BA2BF, 0xBC6E80C8, -/**/ 0x55764214, 0x3FD77102, -/**/ 0x314BB6CE, 0xBC66EAD7, -/**/ 0xEB995912, 0x3FEDC6B7, -/**/ 0x776DCD35, 0x3C54B364, -/**/ 0x03C86D4E, 0x3FD7E7EE, -/**/ 0xDABF5AF2, 0xBC7B63BC, -/**/ 0x6B888E83, 0x3FEDAF0B, -/**/ 0x2B5E5CEA, 0x3C8A249E, -/**/ 0x12826949, 0x3FD85E7A, -/**/ 0x9B5FACE0, 0x3C78A40E, -/**/ 0x2F71A9DC, 0x3FED96E8, -/**/ 0xD5D2039D, 0x3C8FF61B, -/**/ 0xA774992F, 0x3FD8D4A4, -/**/ 0xEA766326, 0x3C744A02, -/**/ 0x97E17B4A, 0x3FED7E4E, -/**/ 0x352BED94, 0xBC63B770, -/**/ 0xE9F546C5, 0x3FD94A6B, -/**/ 0x3E683F58, 0xBC769CE1, -/**/ 0x073E4040, 0x3FED653F, -/**/ 0x434BEC37, 0xBC876236, -/**/ 0x02E80510, 0x3FD9BFCE, -/**/ 0xA320B0A4, 0x3C709E39, -/**/ 0xE1C619E0, 0x3FED4BB9, -/**/ 0x77858F61, 0x3C8F34BB, -/**/ 0x1CC50CCA, 0x3FDA34C9, -/**/ 0x3B50CECD, 0xBC5A310E, -/**/ 0x8D8D7C06, 0x3FED31BF, -/**/ 0x3089CBDD, 0x3C7E60DD, -/**/ 0x63A09277, 0x3FDAA95B, -/**/ 0xB13C0381, 0xBC66293E, -/**/ 0x727D94F0, 0x3FED1750, -/**/ 0x1EC1A48E, 0x3C80D52B, -/**/ 0x05321617, 0x3FDB1D83, -/**/ 0xCB99F519, 0xBC7AE242, -/**/ 0xFA52AD9F, 0x3FECFC6C, -/**/ 0x508F2A0D, 0x3C88B5B5, -/**/ 0x30DBAC43, 0x3FDB913E, -/**/ 0x2F6C3FF1, 0xBC7E38AD, -/**/ 0x909A82E5, 0x3FECE115, -/**/ 0xBB31109A, 0x3C81F139, -/**/ 0x17B140A3, 0x3FDC048B, -/**/ 0x757E9FA7, 0x3C619FE6, -/**/ 0xA2B2972E, 0x3FECC54A, -/**/ 0x2BA83A98, 0x3C64EE16, -/**/ 0xEC7FD19E, 0x3FDC7767, -/**/ 0x1A3D5826, 0xBC5EB14D, -/**/ 0x9FC67D0B, 0x3FECA90C, -/**/ 0x485E3462, 0xBC646A81, -/**/ 0xE3D4A51F, 0x3FDCE9D2, -/**/ 0x12DAE298, 0xBC62FC8A, -/**/ 0xF8CE1A84, 0x3FEC8C5B, -/**/ 0xA1590123, 0x3C7AB3D1, -/**/ 0x34047661, 0x3FDD5BCA, -/**/ 0xA75FC29C, 0x3C728A44, -/**/ 0x208BE53B, 0x3FEC6F39, -/**/ 0xFBAADB42, 0xBC8741DB, -/**/ 0x15329C9A, 0x3FDDCD4C, -/**/ 0xE171FD9A, 0x3C70D4C6, -/**/ 0x8B8B175E, 0x3FEC51A4, -/**/ 0x3B9AA880, 0xBC61BBB4, -/**/ 0xC1582A69, 0x3FDE3E56, -/**/ 0x1099F88F, 0xBC50A482, -/**/ 0xB01DDD81, 0x3FEC339E, -/**/ 0xEE82C5C0, 0xBC8CAAF5, -/**/ 0x744B05F0, 0x3FDEAEE8, -/**/ 0x3C9B027D, 0xBC5789B4, -/**/ 0x065B7D50, 0x3FEC1528, -/**/ 0x1312E828, 0xBC889211, -/**/ 0x6BC4F97B, 0x3FDF1EFF, -/**/ 0xF8A7525C, 0x3C717212, -/**/ 0x081E7536, 0x3FEBF641, -/**/ 0x1628A9A1, 0x3C8B7BD7, -/**/ 0xE76ABC97, 0x3FDF8E99, -/**/ 0xAF2D00A3, 0x3C59D950, -/**/ 0x310294F5, 0x3FEBD6EA, -/**/ 0xC88C109D, 0x3C731BBC, -/**/ 0x28D2F57A, 0x3FDFFDB6, -/**/ 0x2E905B6A, 0x3C6F4A99, -/**/ 0xFE630F32, 0x3FEBB723, -/**/ 0x452D0A39, 0x3C772BD2, -/**/ 0x39C69955, 0x3FE03629, -/**/ 0x78397B01, 0xBC82D8CD, -/**/ 0xEF58840E, 0x3FEB96EE, -/**/ 0xC78FADE0, 0x3C545A3C, -/**/ 0x86946E5B, 0x3FE06D36, -/**/ 0x4538FF1B, 0x3C83F5AE, -/**/ 0x84B704C2, 0x3FEB764B, -/**/ 0xC21B389B, 0xBC8F5848, -/**/ 0x1E9E1001, 0x3FE0A402, -/**/ 0xA13914F6, 0xBC86F643, -/**/ 0x410C104E, 0x3FEB553A, -/**/ 0x47027A16, 0x3C58FF79, -/**/ 0x26B5672E, 0x3FE0DA8B, -/**/ 0xF0BEE909, 0xBC8A58DE, -/**/ 0xA89C8948, 0x3FEB33BB, -/**/ 0x1D1F6CA9, 0x3C8EA6A5, -/**/ 0xC4B69C3B, 0x3FE110D0, -/**/ 0x98809981, 0x3C8D9189, -/**/ 0x4162A4C6, 0x3FEB11D0, -/**/ 0x1EFBC0C2, 0x3C71DD56, -/**/ 0x1F8B7F82, 0x3FE146D2, -/**/ 0x5E2739A8, 0x3C7BF953, -/**/ 0x930BD275, 0x3FEAEF78, -/**/ 0x79746F94, 0xBC7F8362, -/**/ 0x5F2EEDB0, 0x3FE17C8E, -/**/ 0x102E2488, 0x3C635E57, -/**/ 0x26F69DE5, 0x3FEACCB5, -/**/ 0x8DD6B6CC, 0x3C88FB6A, -/**/ 0xACB02FDD, 0x3FE1B204, -/**/ 0x70CBB5FF, 0xBC5F190C, -/**/ 0x88308913, 0x3FEAA986, -/**/ 0x07CD5070, 0xBC0B83D6, -/**/ 0x3236574C, 0x3FE1E734, -/**/ 0xA4F41D5A, 0x3C722A3F, -/**/ 0x4373E02D, 0x3FEA85ED, -/**/ 0x385EC792, 0x3C69BE06, -/**/ 0x1B0394CF, 0x3FE21C1C, -/**/ 0x4B23AA31, 0x3C5E5B32, -/**/ 0xE72586AF, 0x3FEA61E9, -/**/ 0xE2FD453F, 0x3C858330, -/**/ 0x93788BBB, 0x3FE250BB, -/**/ 0x2457BCCE, 0x3C7EA3D0, -/**/ 0x0352BDCF, 0x3FEA3D7D, -/**/ 0xECA19669, 0xBC868DBA, -/**/ 0xC917A067, 0x3FE28511, -/**/ 0xD9A16B70, 0xBC801DF1, -/**/ 0x29AEE445, 0x3FEA18A7, -/**/ 0x736C0358, 0x3C395E25, -/**/ 0xEA88421E, 0x3FE2B91D, -/**/ 0xDB216AB0, 0xBC8FA371, -/**/ 0xED912F85, 0x3FE9F368, -/**/ 0xC5791606, 0xBC81D200, -/**/ 0x279A3082, 0x3FE2ECDF, -/**/ 0xE0E7E37E, 0x3C8D3557, -/**/ 0xE3F25E5C, 0x3FE9CDC2, -/**/ 0x12993F62, 0x3C83F991, -/**/ 0xB148BC4F, 0x3FE32054, -/**/ 0x095A135B, 0x3C8F6B42, -/**/ 0xA36A6514, 0x3FE9A7B5, -/**/ 0xCC9FA7A9, 0x3C8722CF, -/**/ 0xB9BE0367, 0x3FE3537D, -/**/ 0x7AF040F0, 0x3C6B327E, -/**/ 0xC42E1310, 0x3FE98141, -/**/ 0x0488F08D, 0x3C8D1FF8, -/**/ 0x7456282B, 0x3FE38659, -/**/ 0xA93B07A8, 0xBC710FAD, -/**/ 0xE00CB1FD, 0x3FE95A67, -/**/ 0xA21F862D, 0xBC80BEFD, -/**/ 0x15A2840A, 0x3FE3B8E7, -/**/ 0xA7D2F07B, 0xBC797653, -/**/ 0x926D9E92, 0x3FE93328, -/**/ 0x03600CDA, 0xBC8BB770, -/**/ 0xD36CD53A, 0x3FE3EB25, -/**/ 0xE1570FC0, 0xBC5BE570, -/**/ 0x784DDAF7, 0x3FE90B84, -/**/ 0x0AB93B87, 0xBC70FEB1, -/**/ 0xE4BA6790, 0x3FE41D14, -/**/ 0xD287ECF5, 0x3C84608F, -/**/ 0x303D9AD1, 0x3FE8E37C, -/**/ 0xB53D4BF8, 0xBC6463A4, -/**/ 0x81CF386B, 0x3FE44EB3, -/**/ 0x1E6A5505, 0xBC83ED6C, -/**/ 0x5A5DC900, 0x3FE8BB10, -/**/ 0x3E9474C1, 0x3C8863E0, -/**/ 0xE431159F, 0x3FE48000, -/**/ 0x7463ED10, 0xBC8B194A, -/**/ 0x985D871F, 0x3FE89241, -/**/ 0xC413ED84, 0x3C8C48D9, -/**/ 0x46AAB761, 0x3FE4B0FC, -/**/ 0x738CC59A, 0x3C20DA05, -/**/ 0x8D77A6C6, 0x3FE86910, -/**/ 0xE2BFE9DD, 0x3C7338FF, -/**/ 0xE54ED51B, 0x3FE4E1A4, -/**/ 0x89B7C76A, 0xBC8A492F, -/**/ 0xDE701CA0, 0x3FE83F7D, -/**/ 0x609BC6E8, 0xBC4152CF, -/**/ 0xFD7B351C, 0x3FE511F9, -/**/ 0x61C48831, 0xBC85C0E8, -/**/ 0x31916D5D, 0x3FE8158A, -/**/ 0x0B8228DE, 0xBC6DE8B9, -/**/ 0xCDDBB724, 0x3FE541FA, -/**/ 0x8520D391, 0x3C7232C2, -/**/ 0x2EAA1488, 0x3FE7EB36, -/**/ 0xA4A5959F, 0x3C5A1D65, -/**/ 0x966D59B3, 0x3FE571A6, -/**/ 0x4D0FB198, 0x3C5C843B, -/**/ 0x7F09E54F, 0x3FE7C082, -/**/ 0xD72AEE68, 0xBC6C73D6, -/**/ 0x98813A12, 0x3FE5A0FC, -/**/ 0xB7D4227B, 0xBC8D82E2, -/**/ 0xCD7F6543, 0x3FE7956F, -/**/ 0xE9D45AE4, 0xBC8AB276, -/**/ 0x16BF8F0D, 0x3FE5CFFC, -/**/ 0x70EB578A, 0x3C896CB3, -/**/ 0xC655211F, 0x3FE769FE, -/**/ 0xCF8C68C5, 0xBC6827D5, -/**/ 0x552A9E57, 0x3FE5FEA4, -/**/ 0xF7EE20B7, 0x3C80B6CE, -/**/ 0x174EFBA1, 0x3FE73E30, -/**/ 0x3D94AD5F, 0xBC65D3AE, -/**/ 0x9921AC79, 0x3FE62CF4, -/**/ 0x55B6241A, 0xBC8EDD98, -/**/ 0x6FA77678, 0x3FE71204, -/**/ 0xA5029C81, 0x3C8425B0, -/**/ 0x2963E755, 0x3FE65AEC, -/**/ 0x6B71053C, 0x3C8126F9, -/**/ 0x800CF55E, 0x3FE6E57C, -/**/ 0xDEDBD0A6, 0x3C860286, -/**/ 0x4E134B2F, 0x3FE6888A, -/**/ 0x7644D5E6, 0xBC86B7D3, -/**/ 0xFA9EFB5D, 0x3FE6B898, -/**/ 0x86CCF4B2, 0x3C715AC7, -/**/ 0x50B7821A, 0x3FE6B5CE, -/**/ 0x8F702E0F, 0xBC65D515, -/**/ 0x92EB6253, 0x3FE68B5A, -/**/ 0xD985F89C, 0xBC89A91A, -/**/ 0x7C40BDE1, 0x3FE6E2B7, -/**/ 0x857FAD53, 0xBC70E729, -/**/ 0xFDEB8CBA, 0x3FE65DC1, -/**/ 0x47337C77, 0xBC597C1B, -/**/ 0x1D0A8C40, 0x3FE70F45, -/**/ 0x3885770D, 0x3C697EDE, -/**/ 0xF20191C7, 0x3FE62FCF, -/**/ 0x895756EF, 0x3C6D9143, -/**/ 0x80DEA578, 0x3FE73B76, -/**/ 0x06DC12A2, 0xBC722483, -/**/ 0x26F563DF, 0x3FE60185, -/**/ 0xE0E432D0, 0x3C846CA5, -/**/ 0xF6F7B524, 0x3FE7674A, -/**/ 0x94AC84A8, 0x3C7E9D3F, -/**/ 0x55F1F17A, 0x3FE5D2E2, -/**/ 0x04C8892B, 0x3C803141, -/**/ 0xD0041D52, 0x3FE792C1, -/**/ 0xEEB354EB, 0xBC8ABF05, -/**/ 0x39824077, 0x3FE5A3E8, -/**/ 0x2759BE62, 0x3C8428AA, -/**/ 0x5E28B3C2, 0x3FE7BDDA, -/**/ 0x7CCD0393, 0x3C4AD119, -/**/ 0x8D8E83F2, 0x3FE57497, -/**/ 0xAF282D23, 0x3C8F4714, -/**/ 0xF5037959, 0x3FE7E893, -/**/ 0xAA650C4C, 0x3C80EEFB, -/**/ 0x0F592CA5, 0x3FE544F1, -/**/ 0xE6C7A62F, 0xBC8E7AE8, -/**/ 0xE9AE4BA4, 0x3FE812ED, -/**/ 0xDF402DDA, 0xBC87830A, -/**/ 0x7D7BF3DA, 0x3FE514F5, -/**/ 0x8073C259, 0x3C747A10 } }; -#endif -#endif diff --git a/libc/sysdeps/ieee754/dbl-64/sincos32.c b/libc/sysdeps/ieee754/dbl-64/sincos32.c index a4f896a46..e39aaeea0 100644 --- a/libc/sysdeps/ieee754/dbl-64/sincos32.c +++ b/libc/sysdeps/ieee754/dbl-64/sincos32.c @@ -1,7 +1,7 @@ /* * IBM Accurate Mathematical Library * written by International Business Machines Corp. - * Copyright (C) 2001 Free Software Foundation + * Copyright (C) 2001, 2011 Free Software Foundation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -45,11 +45,17 @@ #include "sincos32.h" #include "math_private.h" +#ifndef SECTION +# define SECTION +#endif + /****************************************************************/ /* Compute Multi-Precision sin() function for given p. Receive */ /* Multi Precision number x and result stored at y */ /****************************************************************/ -static void ss32(mp_no *x, mp_no *y, int p) { +static void +SECTION +ss32(mp_no *x, mp_no *y, int p) { int i; double a; #if 0 @@ -79,7 +85,9 @@ static void ss32(mp_no *x, mp_no *y, int p) { /* Compute Multi-Precision cos() function for given p. Receive Multi */ /* Precision number x and result stored at y */ /**********************************************************************/ -static void cc32(mp_no *x, mp_no *y, int p) { +static void +SECTION +cc32(mp_no *x, mp_no *y, int p) { int i; double a; #if 0 @@ -109,7 +117,9 @@ static void cc32(mp_no *x, mp_no *y, int p) { /***************************************************************************/ /* c32() computes both sin(x), cos(x) as Multi precision numbers */ /***************************************************************************/ -void __c32(mp_no *x, mp_no *y, mp_no *z, int p) { +void +SECTION +__c32(mp_no *x, mp_no *y, mp_no *z, int p) { static const mp_no mpt={1,{1.0,2.0}}, one={1,{1.0,1.0}}; mp_no u,t,t1,t2,c,s; int i; @@ -134,7 +144,9 @@ void __c32(mp_no *x, mp_no *y, mp_no *z, int p) { /*result which is more accurate */ /*Computing sin(x) with multi precision routine c32 */ /************************************************************************/ -double __sin32(double x, double res, double res1) { +double +SECTION +__sin32(double x, double res, double res1) { int p; mp_no a,b,c; p=32; @@ -158,7 +170,9 @@ double __sin32(double x, double res, double res1) { /*result which is more accurate */ /*Computing cos(x) with multi precision routine c32 */ /************************************************************************/ -double __cos32(double x, double res, double res1) { +double +SECTION +__cos32(double x, double res, double res1) { int p; mp_no a,b,c; p=32; @@ -172,12 +186,12 @@ double __cos32(double x, double res, double res1) { } else if (x>0.8) { __sub(&hp,&c,&a,p); - __c32(&a,&c,&b,p); + __c32(&a,&c,&b,p); } else __c32(&c,&b,&a,p); /* b=cos(0.5*(res+res1)) */ __dbl_mp(x,&c,p); /* c = x */ __sub(&b,&c,&a,p); - /* if a>0 return max(res,res1), otherwise return min(res,res1) */ + /* if a>0 return max(res,res1), otherwise return min(res,res1) */ if (a.d[0]>0) return (res>res1)?res:res1; else return (res +#include + +/****************************************************************/ +/* TABLES FOR THE usin() and ucos() FUNCTION */ +/****************************************************************/ + + +#ifdef BIG_ENDI +const union {int4 i[880]; double x[440];}__sincostab = { .i = { +/**/ 0x00000000, 0x00000000, +/**/ 0x00000000, 0x00000000, +/**/ 0x3FF00000, 0x00000000, +/**/ 0x00000000, 0x00000000, +/**/ 0x3F7FFFEA, 0xAAAEEEEF, +/**/ 0xBC1E45E2, 0xEC67B77C, +/**/ 0x3FEFFFC0, 0x00155552, +/**/ 0x3C8F4A01, 0xA0196DAE, +/**/ 0x3F8FFFAA, 0xAAEEEED5, +/**/ 0xBC02AB63, 0x9A9F0777, +/**/ 0x3FEFFF00, 0x0155549F, +/**/ 0x3C828A28, 0xA03A5EF3, +/**/ 0x3F97FF70, 0x01033255, +/**/ 0x3BFEFE2B, 0x51527336, +/**/ 0x3FEFFDC0, 0x06BFF7E6, +/**/ 0x3C8AE6DA, 0xE86977BD, +/**/ 0x3F9FFEAA, 0xAEEEE86F, +/**/ 0xBC3CD406, 0xFB224AE2, +/**/ 0x3FEFFC00, 0x155527D3, +/**/ 0xBC83B544, 0x92D89B5B, +/**/ 0x3FA3FEB2, 0xB12D45D5, +/**/ 0x3C34EC54, 0x203D1C11, +/**/ 0x3FEFF9C0, 0x3414A7BA, +/**/ 0x3C6991F4, 0xBE6C59BF, +/**/ 0x3FA7FDC0, 0x1032FBA9, +/**/ 0xBC4599BD, 0xF46E997A, +/**/ 0x3FEFF700, 0x6BFDF99F, +/**/ 0xBC78B3B5, 0x60648D5F, +/**/ 0x3FABFC6D, 0x78586DAC, +/**/ 0x3C18E4FD, 0x03DBF236, +/**/ 0x3FEFF3C0, 0xC8103A31, +/**/ 0x3C74856D, 0xBDDC0E66, +/**/ 0x3FAFFAAA, 0xEEED4EDB, +/**/ 0xBC42D16D, 0x32684B69, +/**/ 0x3FEFF001, 0x5549F4D3, +/**/ 0x3C832838, 0x7B99426F, +/**/ 0x3FB1FC34, 0x3D808BEF, +/**/ 0xBC5F3D32, 0xE6F3BE4F, +/**/ 0x3FEFEBC2, 0x22A8EF9F, +/**/ 0x3C579349, 0x34F54C77, +/**/ 0x3FB3FACB, 0x12D1755B, +/**/ 0xBC592191, 0x5299468C, +/**/ 0x3FEFE703, 0x4129EF6F, +/**/ 0xBC6CBF43, 0x37C96F97, +/**/ 0x3FB5F911, 0xFD10B737, +/**/ 0xBC50184F, 0x02BE9102, +/**/ 0x3FEFE1C4, 0xC3C873EB, +/**/ 0xBC35A9C9, 0x057C4A02, +/**/ 0x3FB7F701, 0x032550E4, +/**/ 0x3C3AFC2D, 0x1800501A, +/**/ 0x3FEFDC06, 0xBF7E6B9B, +/**/ 0x3C831902, 0xB535F8DB, +/**/ 0x3FB9F490, 0x2D55D1F9, +/**/ 0x3C52696D, 0x7EAC1DC1, +/**/ 0x3FEFD5C9, 0x4B43E000, +/**/ 0xBC62E768, 0xCB4F92F9, +/**/ 0x3FBBF1B7, 0x8568391D, +/**/ 0x3C5E9184, 0x1DEA4CC8, +/**/ 0x3FEFCF0C, 0x800E99B1, +/**/ 0x3C6EA3D7, 0x86D186AC, +/**/ 0x3FBDEE6F, 0x16C1CCE6, +/**/ 0xBC450F8E, 0x2FB71673, +/**/ 0x3FEFC7D0, 0x78D1BC88, +/**/ 0x3C8075D2, 0x447DB685, +/**/ 0x3FBFEAAE, 0xEE86EE36, +/**/ 0xBC4AFCB2, 0xBCC6F03B, +/**/ 0x3FEFC015, 0x527D5BD3, +/**/ 0x3C8B68F3, 0x5094EFB8, +/**/ 0x3FC0F337, 0x8DDD71D1, +/**/ 0x3C6D8468, 0x724F0F9E, +/**/ 0x3FEFB7DB, 0x2BFE0695, +/**/ 0x3C821DAD, 0xF4F65AB1, +/**/ 0x3FC1F0D3, 0xD7AFCEAF, +/**/ 0xBC66EF95, 0x099769A5, +/**/ 0x3FEFAF22, 0x263C4BD3, +/**/ 0xBC552ACE, 0x133A2769, +/**/ 0x3FC2EE28, 0x5E4AB88F, +/**/ 0xBC6E4D0F, 0x05DEE058, +/**/ 0x3FEFA5EA, 0x641C36F2, +/**/ 0x3C404DA6, 0xED17CC7C, +/**/ 0x3FC3EB31, 0x2C5D66CB, +/**/ 0x3C647D66, 0x6B66CB91, +/**/ 0x3FEF9C34, 0x0A7CC428, +/**/ 0x3C8C5B6B, 0x063B7462, +/**/ 0x3FC4E7EA, 0x4DC5F27B, +/**/ 0x3C5949DB, 0x2AC072FC, +/**/ 0x3FEF91FF, 0x40374D01, +/**/ 0xBC67D03F, 0x4D3A9E4C, +/**/ 0x3FC5E44F, 0xCFA126F3, +/**/ 0xBC66F443, 0x063F89B6, +/**/ 0x3FEF874C, 0x2E1EECF6, +/**/ 0xBC8C6514, 0xE1332B16, +/**/ 0x3FC6E05D, 0xC05A4D4C, +/**/ 0xBBD32C5C, 0x8B81C940, +/**/ 0x3FEF7C1A, 0xFEFFDE24, +/**/ 0xBC78F55B, 0xC47540B1, +/**/ 0x3FC7DC10, 0x2FBAF2B5, +/**/ 0x3C45AB50, 0xE23C97C3, +/**/ 0x3FEF706B, 0xDF9ECE1C, +/**/ 0xBC8698C8, 0x0C36DCB4, +/**/ 0x3FC8D763, 0x2EFAA944, +/**/ 0xBC620FA2, 0x62CBB953, +/**/ 0x3FEF643E, 0xFEB82ACD, +/**/ 0x3C76B00A, 0xC1FE28AC, +/**/ 0x3FC9D252, 0xD0CEC312, +/**/ 0x3C59C43D, 0x80B1137D, +/**/ 0x3FEF5794, 0x8CFF6797, +/**/ 0x3C6E3A0D, 0x3E03B1D5, +/**/ 0x3FCACCDB, 0x297A0765, +/**/ 0xBC59883B, 0x57D6CDEB, +/**/ 0x3FEF4A6C, 0xBD1E3A79, +/**/ 0x3C813DF0, 0xEDAEBB57, +/**/ 0x3FCBC6F8, 0x4EDC6199, +/**/ 0x3C69C1A5, 0x6A7B0CAB, +/**/ 0x3FEF3CC7, 0xC3B3D16E, +/**/ 0xBC621A3A, 0xD28A3494, +/**/ 0x3FCCC0A6, 0x588289A3, +/**/ 0xBC6868D0, 0x9BC87C6B, +/**/ 0x3FEF2EA5, 0xD753FFED, +/**/ 0x3C8CC421, 0x5F56D583, +/**/ 0x3FCDB9E1, 0x5FB5A5D0, +/**/ 0xBC632E20, 0xD6CC6FC2, +/**/ 0x3FEF2007, 0x3086649F, +/**/ 0x3C7B9404, 0x16C1984B, +/**/ 0x3FCEB2A5, 0x7F8AE5A3, +/**/ 0xBC60BE06, 0xAF572CEB, +/**/ 0x3FEF10EC, 0x09C5873B, +/**/ 0x3C8D9072, 0x762C1283, +/**/ 0x3FCFAAEE, 0xD4F31577, +/**/ 0xBC615D88, 0x508E32B8, +/**/ 0x3FEF0154, 0x9F7DEEA1, +/**/ 0x3C8D3C1E, 0x99E5CAFD, +/**/ 0x3FD0515C, 0xBF65155C, +/**/ 0xBC79B8C2, 0x9DFD8EC8, +/**/ 0x3FEEF141, 0x300D2F26, +/**/ 0xBC82AA1B, 0x08DED372, +/**/ 0x3FD0CD00, 0xCEF36436, +/**/ 0xBC79FB0A, 0x0C93E2B5, +/**/ 0x3FEEE0B1, 0xFBC0F11C, +/**/ 0xBC4BFD23, 0x80BBC3B1, +/**/ 0x3FD14861, 0xAA94DDEB, +/**/ 0xBC6BE881, 0xB5B615A4, +/**/ 0x3FEECFA7, 0x44D5EFA1, +/**/ 0xBC556D0A, 0x4AF541D0, +/**/ 0x3FD1C37D, 0x64C6B876, +/**/ 0x3C746076, 0xFE0DCFF5, +/**/ 0x3FEEBE21, 0x4F76EFA8, +/**/ 0xBC802F9F, 0x12BA543E, +/**/ 0x3FD23E52, 0x111AAF36, +/**/ 0xBC74F080, 0x334EFF18, +/**/ 0x3FEEAC20, 0x61BBAF4F, +/**/ 0x3C62C1D5, 0x3E94658D, +/**/ 0x3FD2B8DD, 0xC43EB49F, +/**/ 0x3C615538, 0x99F2D807, +/**/ 0x3FEE99A4, 0xC3A7CD83, +/**/ 0xBC82264B, 0x1BC53CE8, +/**/ 0x3FD3331E, 0x94049F87, +/**/ 0x3C7E0CB6, 0xB40C302C, +/**/ 0x3FEE86AE, 0xBF29A9ED, +/**/ 0x3C89397A, 0xFDBB58A7, +/**/ 0x3FD3AD12, 0x9769D3D8, +/**/ 0x3C003D55, 0x04878398, +/**/ 0x3FEE733E, 0xA0193D40, +/**/ 0xBC86428B, 0x3546CE13, +/**/ 0x3FD426B7, 0xE69EE697, +/**/ 0xBC7F09C7, 0x5705C59F, +/**/ 0x3FEE5F54, 0xB436E9D0, +/**/ 0x3C87EB0F, 0xD02FC8BC, +/**/ 0x3FD4A00C, 0x9B0F3D20, +/**/ 0x3C7823BA, 0x6BB08EAD, +/**/ 0x3FEE4AF1, 0x4B2A449C, +/**/ 0xBC868CA0, 0x2E8A6833, +/**/ 0x3FD5190E, 0xCF68A77A, +/**/ 0x3C7B3571, 0x55EEF0F3, +/**/ 0x3FEE3614, 0xB680D6A5, +/**/ 0xBC727793, 0xAA015237, +/**/ 0x3FD591BC, 0x9FA2F597, +/**/ 0x3C67C74B, 0xAC3FE0CB, +/**/ 0x3FEE20BF, 0x49ACD6C1, +/**/ 0xBC5660AE, 0xC7EF636C, +/**/ 0x3FD60A14, 0x29078775, +/**/ 0x3C5B1FD8, 0x0BA89133, +/**/ 0x3FEE0AF1, 0x5A03DBCE, +/**/ 0x3C5FE8E7, 0x02771AE6, +/**/ 0x3FD68213, 0x8A38D7F7, +/**/ 0xBC7D8892, 0x02444AAD, +/**/ 0x3FEDF4AB, 0x3EBD875E, +/**/ 0xBC8E2D8A, 0x7E6736C4, +/**/ 0x3FD6F9B8, 0xE33A0255, +/**/ 0x3C742BC1, 0x4EE9DA0D, +/**/ 0x3FEDDDED, 0x50F228D6, +/**/ 0xBC6E80C8, 0xD42BA2BF, +/**/ 0x3FD77102, 0x55764214, +/**/ 0xBC66EAD7, 0x314BB6CE, +/**/ 0x3FEDC6B7, 0xEB995912, +/**/ 0x3C54B364, 0x776DCD35, +/**/ 0x3FD7E7EE, 0x03C86D4E, +/**/ 0xBC7B63BC, 0xDABF5AF2, +/**/ 0x3FEDAF0B, 0x6B888E83, +/**/ 0x3C8A249E, 0x2B5E5CEA, +/**/ 0x3FD85E7A, 0x12826949, +/**/ 0x3C78A40E, 0x9B5FACE0, +/**/ 0x3FED96E8, 0x2F71A9DC, +/**/ 0x3C8FF61B, 0xD5D2039D, +/**/ 0x3FD8D4A4, 0xA774992F, +/**/ 0x3C744A02, 0xEA766326, +/**/ 0x3FED7E4E, 0x97E17B4A, +/**/ 0xBC63B770, 0x352BED94, +/**/ 0x3FD94A6B, 0xE9F546C5, +/**/ 0xBC769CE1, 0x3E683F58, +/**/ 0x3FED653F, 0x073E4040, +/**/ 0xBC876236, 0x434BEC37, +/**/ 0x3FD9BFCE, 0x02E80510, +/**/ 0x3C709E39, 0xA320B0A4, +/**/ 0x3FED4BB9, 0xE1C619E0, +/**/ 0x3C8F34BB, 0x77858F61, +/**/ 0x3FDA34C9, 0x1CC50CCA, +/**/ 0xBC5A310E, 0x3B50CECD, +/**/ 0x3FED31BF, 0x8D8D7C06, +/**/ 0x3C7E60DD, 0x3089CBDD, +/**/ 0x3FDAA95B, 0x63A09277, +/**/ 0xBC66293E, 0xB13C0381, +/**/ 0x3FED1750, 0x727D94F0, +/**/ 0x3C80D52B, 0x1EC1A48E, +/**/ 0x3FDB1D83, 0x05321617, +/**/ 0xBC7AE242, 0xCB99F519, +/**/ 0x3FECFC6C, 0xFA52AD9F, +/**/ 0x3C88B5B5, 0x508F2A0D, +/**/ 0x3FDB913E, 0x30DBAC43, +/**/ 0xBC7E38AD, 0x2F6C3FF1, +/**/ 0x3FECE115, 0x909A82E5, +/**/ 0x3C81F139, 0xBB31109A, +/**/ 0x3FDC048B, 0x17B140A3, +/**/ 0x3C619FE6, 0x757E9FA7, +/**/ 0x3FECC54A, 0xA2B2972E, +/**/ 0x3C64EE16, 0x2BA83A98, +/**/ 0x3FDC7767, 0xEC7FD19E, +/**/ 0xBC5EB14D, 0x1A3D5826, +/**/ 0x3FECA90C, 0x9FC67D0B, +/**/ 0xBC646A81, 0x485E3462, +/**/ 0x3FDCE9D2, 0xE3D4A51F, +/**/ 0xBC62FC8A, 0x12DAE298, +/**/ 0x3FEC8C5B, 0xF8CE1A84, +/**/ 0x3C7AB3D1, 0xA1590123, +/**/ 0x3FDD5BCA, 0x34047661, +/**/ 0x3C728A44, 0xA75FC29C, +/**/ 0x3FEC6F39, 0x208BE53B, +/**/ 0xBC8741DB, 0xFBAADB42, +/**/ 0x3FDDCD4C, 0x15329C9A, +/**/ 0x3C70D4C6, 0xE171FD9A, +/**/ 0x3FEC51A4, 0x8B8B175E, +/**/ 0xBC61BBB4, 0x3B9AA880, +/**/ 0x3FDE3E56, 0xC1582A69, +/**/ 0xBC50A482, 0x1099F88F, +/**/ 0x3FEC339E, 0xB01DDD81, +/**/ 0xBC8CAAF5, 0xEE82C5C0, +/**/ 0x3FDEAEE8, 0x744B05F0, +/**/ 0xBC5789B4, 0x3C9B027D, +/**/ 0x3FEC1528, 0x065B7D50, +/**/ 0xBC889211, 0x1312E828, +/**/ 0x3FDF1EFF, 0x6BC4F97B, +/**/ 0x3C717212, 0xF8A7525C, +/**/ 0x3FEBF641, 0x081E7536, +/**/ 0x3C8B7BD7, 0x1628A9A1, +/**/ 0x3FDF8E99, 0xE76ABC97, +/**/ 0x3C59D950, 0xAF2D00A3, +/**/ 0x3FEBD6EA, 0x310294F5, +/**/ 0x3C731BBC, 0xC88C109D, +/**/ 0x3FDFFDB6, 0x28D2F57A, +/**/ 0x3C6F4A99, 0x2E905B6A, +/**/ 0x3FEBB723, 0xFE630F32, +/**/ 0x3C772BD2, 0x452D0A39, +/**/ 0x3FE03629, 0x39C69955, +/**/ 0xBC82D8CD, 0x78397B01, +/**/ 0x3FEB96EE, 0xEF58840E, +/**/ 0x3C545A3C, 0xC78FADE0, +/**/ 0x3FE06D36, 0x86946E5B, +/**/ 0x3C83F5AE, 0x4538FF1B, +/**/ 0x3FEB764B, 0x84B704C2, +/**/ 0xBC8F5848, 0xC21B389B, +/**/ 0x3FE0A402, 0x1E9E1001, +/**/ 0xBC86F643, 0xA13914F6, +/**/ 0x3FEB553A, 0x410C104E, +/**/ 0x3C58FF79, 0x47027A16, +/**/ 0x3FE0DA8B, 0x26B5672E, +/**/ 0xBC8A58DE, 0xF0BEE909, +/**/ 0x3FEB33BB, 0xA89C8948, +/**/ 0x3C8EA6A5, 0x1D1F6CA9, +/**/ 0x3FE110D0, 0xC4B69C3B, +/**/ 0x3C8D9189, 0x98809981, +/**/ 0x3FEB11D0, 0x4162A4C6, +/**/ 0x3C71DD56, 0x1EFBC0C2, +/**/ 0x3FE146D2, 0x1F8B7F82, +/**/ 0x3C7BF953, 0x5E2739A8, +/**/ 0x3FEAEF78, 0x930BD275, +/**/ 0xBC7F8362, 0x79746F94, +/**/ 0x3FE17C8E, 0x5F2EEDB0, +/**/ 0x3C635E57, 0x102E2488, +/**/ 0x3FEACCB5, 0x26F69DE5, +/**/ 0x3C88FB6A, 0x8DD6B6CC, +/**/ 0x3FE1B204, 0xACB02FDD, +/**/ 0xBC5F190C, 0x70CBB5FF, +/**/ 0x3FEAA986, 0x88308913, +/**/ 0xBC0B83D6, 0x07CD5070, +/**/ 0x3FE1E734, 0x3236574C, +/**/ 0x3C722A3F, 0xA4F41D5A, +/**/ 0x3FEA85ED, 0x4373E02D, +/**/ 0x3C69BE06, 0x385EC792, +/**/ 0x3FE21C1C, 0x1B0394CF, +/**/ 0x3C5E5B32, 0x4B23AA31, +/**/ 0x3FEA61E9, 0xE72586AF, +/**/ 0x3C858330, 0xE2FD453F, +/**/ 0x3FE250BB, 0x93788BBB, +/**/ 0x3C7EA3D0, 0x2457BCCE, +/**/ 0x3FEA3D7D, 0x0352BDCF, +/**/ 0xBC868DBA, 0xECA19669, +/**/ 0x3FE28511, 0xC917A067, +/**/ 0xBC801DF1, 0xD9A16B70, +/**/ 0x3FEA18A7, 0x29AEE445, +/**/ 0x3C395E25, 0x736C0358, +/**/ 0x3FE2B91D, 0xEA88421E, +/**/ 0xBC8FA371, 0xDB216AB0, +/**/ 0x3FE9F368, 0xED912F85, +/**/ 0xBC81D200, 0xC5791606, +/**/ 0x3FE2ECDF, 0x279A3082, +/**/ 0x3C8D3557, 0xE0E7E37E, +/**/ 0x3FE9CDC2, 0xE3F25E5C, +/**/ 0x3C83F991, 0x12993F62, +/**/ 0x3FE32054, 0xB148BC4F, +/**/ 0x3C8F6B42, 0x095A135B, +/**/ 0x3FE9A7B5, 0xA36A6514, +/**/ 0x3C8722CF, 0xCC9FA7A9, +/**/ 0x3FE3537D, 0xB9BE0367, +/**/ 0x3C6B327E, 0x7AF040F0, +/**/ 0x3FE98141, 0xC42E1310, +/**/ 0x3C8D1FF8, 0x0488F08D, +/**/ 0x3FE38659, 0x7456282B, +/**/ 0xBC710FAD, 0xA93B07A8, +/**/ 0x3FE95A67, 0xE00CB1FD, +/**/ 0xBC80BEFD, 0xA21F862D, +/**/ 0x3FE3B8E7, 0x15A2840A, +/**/ 0xBC797653, 0xA7D2F07B, +/**/ 0x3FE93328, 0x926D9E92, +/**/ 0xBC8BB770, 0x03600CDA, +/**/ 0x3FE3EB25, 0xD36CD53A, +/**/ 0xBC5BE570, 0xE1570FC0, +/**/ 0x3FE90B84, 0x784DDAF7, +/**/ 0xBC70FEB1, 0x0AB93B87, +/**/ 0x3FE41D14, 0xE4BA6790, +/**/ 0x3C84608F, 0xD287ECF5, +/**/ 0x3FE8E37C, 0x303D9AD1, +/**/ 0xBC6463A4, 0xB53D4BF8, +/**/ 0x3FE44EB3, 0x81CF386B, +/**/ 0xBC83ED6C, 0x1E6A5505, +/**/ 0x3FE8BB10, 0x5A5DC900, +/**/ 0x3C8863E0, 0x3E9474C1, +/**/ 0x3FE48000, 0xE431159F, +/**/ 0xBC8B194A, 0x7463ED10, +/**/ 0x3FE89241, 0x985D871F, +/**/ 0x3C8C48D9, 0xC413ED84, +/**/ 0x3FE4B0FC, 0x46AAB761, +/**/ 0x3C20DA05, 0x738CC59A, +/**/ 0x3FE86910, 0x8D77A6C6, +/**/ 0x3C7338FF, 0xE2BFE9DD, +/**/ 0x3FE4E1A4, 0xE54ED51B, +/**/ 0xBC8A492F, 0x89B7C76A, +/**/ 0x3FE83F7D, 0xDE701CA0, +/**/ 0xBC4152CF, 0x609BC6E8, +/**/ 0x3FE511F9, 0xFD7B351C, +/**/ 0xBC85C0E8, 0x61C48831, +/**/ 0x3FE8158A, 0x31916D5D, +/**/ 0xBC6DE8B9, 0x0B8228DE, +/**/ 0x3FE541FA, 0xCDDBB724, +/**/ 0x3C7232C2, 0x8520D391, +/**/ 0x3FE7EB36, 0x2EAA1488, +/**/ 0x3C5A1D65, 0xA4A5959F, +/**/ 0x3FE571A6, 0x966D59B3, +/**/ 0x3C5C843B, 0x4D0FB198, +/**/ 0x3FE7C082, 0x7F09E54F, +/**/ 0xBC6C73D6, 0xD72AEE68, +/**/ 0x3FE5A0FC, 0x98813A12, +/**/ 0xBC8D82E2, 0xB7D4227B, +/**/ 0x3FE7956F, 0xCD7F6543, +/**/ 0xBC8AB276, 0xE9D45AE4, +/**/ 0x3FE5CFFC, 0x16BF8F0D, +/**/ 0x3C896CB3, 0x70EB578A, +/**/ 0x3FE769FE, 0xC655211F, +/**/ 0xBC6827D5, 0xCF8C68C5, +/**/ 0x3FE5FEA4, 0x552A9E57, +/**/ 0x3C80B6CE, 0xF7EE20B7, +/**/ 0x3FE73E30, 0x174EFBA1, +/**/ 0xBC65D3AE, 0x3D94AD5F, +/**/ 0x3FE62CF4, 0x9921AC79, +/**/ 0xBC8EDD98, 0x55B6241A, +/**/ 0x3FE71204, 0x6FA77678, +/**/ 0x3C8425B0, 0xA5029C81, +/**/ 0x3FE65AEC, 0x2963E755, +/**/ 0x3C8126F9, 0x6B71053C, +/**/ 0x3FE6E57C, 0x800CF55E, +/**/ 0x3C860286, 0xDEDBD0A6, +/**/ 0x3FE6888A, 0x4E134B2F, +/**/ 0xBC86B7D3, 0x7644D5E6, +/**/ 0x3FE6B898, 0xFA9EFB5D, +/**/ 0x3C715AC7, 0x86CCF4B2, +/**/ 0x3FE6B5CE, 0x50B7821A, +/**/ 0xBC65D515, 0x8F702E0F, +/**/ 0x3FE68B5A, 0x92EB6253, +/**/ 0xBC89A91A, 0xD985F89C, +/**/ 0x3FE6E2B7, 0x7C40BDE1, +/**/ 0xBC70E729, 0x857FAD53, +/**/ 0x3FE65DC1, 0xFDEB8CBA, +/**/ 0xBC597C1B, 0x47337C77, +/**/ 0x3FE70F45, 0x1D0A8C40, +/**/ 0x3C697EDE, 0x3885770D, +/**/ 0x3FE62FCF, 0xF20191C7, +/**/ 0x3C6D9143, 0x895756EF, +/**/ 0x3FE73B76, 0x80DEA578, +/**/ 0xBC722483, 0x06DC12A2, +/**/ 0x3FE60185, 0x26F563DF, +/**/ 0x3C846CA5, 0xE0E432D0, +/**/ 0x3FE7674A, 0xF6F7B524, +/**/ 0x3C7E9D3F, 0x94AC84A8, +/**/ 0x3FE5D2E2, 0x55F1F17A, +/**/ 0x3C803141, 0x04C8892B, +/**/ 0x3FE792C1, 0xD0041D52, +/**/ 0xBC8ABF05, 0xEEB354EB, +/**/ 0x3FE5A3E8, 0x39824077, +/**/ 0x3C8428AA, 0x2759BE62, +/**/ 0x3FE7BDDA, 0x5E28B3C2, +/**/ 0x3C4AD119, 0x7CCD0393, +/**/ 0x3FE57497, 0x8D8E83F2, +/**/ 0x3C8F4714, 0xAF282D23, +/**/ 0x3FE7E893, 0xF5037959, +/**/ 0x3C80EEFB, 0xAA650C4C, +/**/ 0x3FE544F1, 0x0F592CA5, +/**/ 0xBC8E7AE8, 0xE6C7A62F, +/**/ 0x3FE812ED, 0xE9AE4BA4, +/**/ 0xBC87830A, 0xDF402DDA, +/**/ 0x3FE514F5, 0x7D7BF3DA, +/**/ 0x3C747A10, 0x8073C259 } }; +#else +#ifdef LITTLE_ENDI +const union {int4 i[880]; double x[440];} __sincostab = { .i = { +/**/ 0x00000000, 0x00000000, +/**/ 0x00000000, 0x00000000, +/**/ 0x00000000, 0x3FF00000, +/**/ 0x00000000, 0x00000000, +/**/ 0xAAAEEEEF, 0x3F7FFFEA, +/**/ 0xEC67B77C, 0xBC1E45E2, +/**/ 0x00155552, 0x3FEFFFC0, +/**/ 0xA0196DAE, 0x3C8F4A01, +/**/ 0xAAEEEED5, 0x3F8FFFAA, +/**/ 0x9A9F0777, 0xBC02AB63, +/**/ 0x0155549F, 0x3FEFFF00, +/**/ 0xA03A5EF3, 0x3C828A28, +/**/ 0x01033255, 0x3F97FF70, +/**/ 0x51527336, 0x3BFEFE2B, +/**/ 0x06BFF7E6, 0x3FEFFDC0, +/**/ 0xE86977BD, 0x3C8AE6DA, +/**/ 0xAEEEE86F, 0x3F9FFEAA, +/**/ 0xFB224AE2, 0xBC3CD406, +/**/ 0x155527D3, 0x3FEFFC00, +/**/ 0x92D89B5B, 0xBC83B544, +/**/ 0xB12D45D5, 0x3FA3FEB2, +/**/ 0x203D1C11, 0x3C34EC54, +/**/ 0x3414A7BA, 0x3FEFF9C0, +/**/ 0xBE6C59BF, 0x3C6991F4, +/**/ 0x1032FBA9, 0x3FA7FDC0, +/**/ 0xF46E997A, 0xBC4599BD, +/**/ 0x6BFDF99F, 0x3FEFF700, +/**/ 0x60648D5F, 0xBC78B3B5, +/**/ 0x78586DAC, 0x3FABFC6D, +/**/ 0x03DBF236, 0x3C18E4FD, +/**/ 0xC8103A31, 0x3FEFF3C0, +/**/ 0xBDDC0E66, 0x3C74856D, +/**/ 0xEEED4EDB, 0x3FAFFAAA, +/**/ 0x32684B69, 0xBC42D16D, +/**/ 0x5549F4D3, 0x3FEFF001, +/**/ 0x7B99426F, 0x3C832838, +/**/ 0x3D808BEF, 0x3FB1FC34, +/**/ 0xE6F3BE4F, 0xBC5F3D32, +/**/ 0x22A8EF9F, 0x3FEFEBC2, +/**/ 0x34F54C77, 0x3C579349, +/**/ 0x12D1755B, 0x3FB3FACB, +/**/ 0x5299468C, 0xBC592191, +/**/ 0x4129EF6F, 0x3FEFE703, +/**/ 0x37C96F97, 0xBC6CBF43, +/**/ 0xFD10B737, 0x3FB5F911, +/**/ 0x02BE9102, 0xBC50184F, +/**/ 0xC3C873EB, 0x3FEFE1C4, +/**/ 0x057C4A02, 0xBC35A9C9, +/**/ 0x032550E4, 0x3FB7F701, +/**/ 0x1800501A, 0x3C3AFC2D, +/**/ 0xBF7E6B9B, 0x3FEFDC06, +/**/ 0xB535F8DB, 0x3C831902, +/**/ 0x2D55D1F9, 0x3FB9F490, +/**/ 0x7EAC1DC1, 0x3C52696D, +/**/ 0x4B43E000, 0x3FEFD5C9, +/**/ 0xCB4F92F9, 0xBC62E768, +/**/ 0x8568391D, 0x3FBBF1B7, +/**/ 0x1DEA4CC8, 0x3C5E9184, +/**/ 0x800E99B1, 0x3FEFCF0C, +/**/ 0x86D186AC, 0x3C6EA3D7, +/**/ 0x16C1CCE6, 0x3FBDEE6F, +/**/ 0x2FB71673, 0xBC450F8E, +/**/ 0x78D1BC88, 0x3FEFC7D0, +/**/ 0x447DB685, 0x3C8075D2, +/**/ 0xEE86EE36, 0x3FBFEAAE, +/**/ 0xBCC6F03B, 0xBC4AFCB2, +/**/ 0x527D5BD3, 0x3FEFC015, +/**/ 0x5094EFB8, 0x3C8B68F3, +/**/ 0x8DDD71D1, 0x3FC0F337, +/**/ 0x724F0F9E, 0x3C6D8468, +/**/ 0x2BFE0695, 0x3FEFB7DB, +/**/ 0xF4F65AB1, 0x3C821DAD, +/**/ 0xD7AFCEAF, 0x3FC1F0D3, +/**/ 0x099769A5, 0xBC66EF95, +/**/ 0x263C4BD3, 0x3FEFAF22, +/**/ 0x133A2769, 0xBC552ACE, +/**/ 0x5E4AB88F, 0x3FC2EE28, +/**/ 0x05DEE058, 0xBC6E4D0F, +/**/ 0x641C36F2, 0x3FEFA5EA, +/**/ 0xED17CC7C, 0x3C404DA6, +/**/ 0x2C5D66CB, 0x3FC3EB31, +/**/ 0x6B66CB91, 0x3C647D66, +/**/ 0x0A7CC428, 0x3FEF9C34, +/**/ 0x063B7462, 0x3C8C5B6B, +/**/ 0x4DC5F27B, 0x3FC4E7EA, +/**/ 0x2AC072FC, 0x3C5949DB, +/**/ 0x40374D01, 0x3FEF91FF, +/**/ 0x4D3A9E4C, 0xBC67D03F, +/**/ 0xCFA126F3, 0x3FC5E44F, +/**/ 0x063F89B6, 0xBC66F443, +/**/ 0x2E1EECF6, 0x3FEF874C, +/**/ 0xE1332B16, 0xBC8C6514, +/**/ 0xC05A4D4C, 0x3FC6E05D, +/**/ 0x8B81C940, 0xBBD32C5C, +/**/ 0xFEFFDE24, 0x3FEF7C1A, +/**/ 0xC47540B1, 0xBC78F55B, +/**/ 0x2FBAF2B5, 0x3FC7DC10, +/**/ 0xE23C97C3, 0x3C45AB50, +/**/ 0xDF9ECE1C, 0x3FEF706B, +/**/ 0x0C36DCB4, 0xBC8698C8, +/**/ 0x2EFAA944, 0x3FC8D763, +/**/ 0x62CBB953, 0xBC620FA2, +/**/ 0xFEB82ACD, 0x3FEF643E, +/**/ 0xC1FE28AC, 0x3C76B00A, +/**/ 0xD0CEC312, 0x3FC9D252, +/**/ 0x80B1137D, 0x3C59C43D, +/**/ 0x8CFF6797, 0x3FEF5794, +/**/ 0x3E03B1D5, 0x3C6E3A0D, +/**/ 0x297A0765, 0x3FCACCDB, +/**/ 0x57D6CDEB, 0xBC59883B, +/**/ 0xBD1E3A79, 0x3FEF4A6C, +/**/ 0xEDAEBB57, 0x3C813DF0, +/**/ 0x4EDC6199, 0x3FCBC6F8, +/**/ 0x6A7B0CAB, 0x3C69C1A5, +/**/ 0xC3B3D16E, 0x3FEF3CC7, +/**/ 0xD28A3494, 0xBC621A3A, +/**/ 0x588289A3, 0x3FCCC0A6, +/**/ 0x9BC87C6B, 0xBC6868D0, +/**/ 0xD753FFED, 0x3FEF2EA5, +/**/ 0x5F56D583, 0x3C8CC421, +/**/ 0x5FB5A5D0, 0x3FCDB9E1, +/**/ 0xD6CC6FC2, 0xBC632E20, +/**/ 0x3086649F, 0x3FEF2007, +/**/ 0x16C1984B, 0x3C7B9404, +/**/ 0x7F8AE5A3, 0x3FCEB2A5, +/**/ 0xAF572CEB, 0xBC60BE06, +/**/ 0x09C5873B, 0x3FEF10EC, +/**/ 0x762C1283, 0x3C8D9072, +/**/ 0xD4F31577, 0x3FCFAAEE, +/**/ 0x508E32B8, 0xBC615D88, +/**/ 0x9F7DEEA1, 0x3FEF0154, +/**/ 0x99E5CAFD, 0x3C8D3C1E, +/**/ 0xBF65155C, 0x3FD0515C, +/**/ 0x9DFD8EC8, 0xBC79B8C2, +/**/ 0x300D2F26, 0x3FEEF141, +/**/ 0x08DED372, 0xBC82AA1B, +/**/ 0xCEF36436, 0x3FD0CD00, +/**/ 0x0C93E2B5, 0xBC79FB0A, +/**/ 0xFBC0F11C, 0x3FEEE0B1, +/**/ 0x80BBC3B1, 0xBC4BFD23, +/**/ 0xAA94DDEB, 0x3FD14861, +/**/ 0xB5B615A4, 0xBC6BE881, +/**/ 0x44D5EFA1, 0x3FEECFA7, +/**/ 0x4AF541D0, 0xBC556D0A, +/**/ 0x64C6B876, 0x3FD1C37D, +/**/ 0xFE0DCFF5, 0x3C746076, +/**/ 0x4F76EFA8, 0x3FEEBE21, +/**/ 0x12BA543E, 0xBC802F9F, +/**/ 0x111AAF36, 0x3FD23E52, +/**/ 0x334EFF18, 0xBC74F080, +/**/ 0x61BBAF4F, 0x3FEEAC20, +/**/ 0x3E94658D, 0x3C62C1D5, +/**/ 0xC43EB49F, 0x3FD2B8DD, +/**/ 0x99F2D807, 0x3C615538, +/**/ 0xC3A7CD83, 0x3FEE99A4, +/**/ 0x1BC53CE8, 0xBC82264B, +/**/ 0x94049F87, 0x3FD3331E, +/**/ 0xB40C302C, 0x3C7E0CB6, +/**/ 0xBF29A9ED, 0x3FEE86AE, +/**/ 0xFDBB58A7, 0x3C89397A, +/**/ 0x9769D3D8, 0x3FD3AD12, +/**/ 0x04878398, 0x3C003D55, +/**/ 0xA0193D40, 0x3FEE733E, +/**/ 0x3546CE13, 0xBC86428B, +/**/ 0xE69EE697, 0x3FD426B7, +/**/ 0x5705C59F, 0xBC7F09C7, +/**/ 0xB436E9D0, 0x3FEE5F54, +/**/ 0xD02FC8BC, 0x3C87EB0F, +/**/ 0x9B0F3D20, 0x3FD4A00C, +/**/ 0x6BB08EAD, 0x3C7823BA, +/**/ 0x4B2A449C, 0x3FEE4AF1, +/**/ 0x2E8A6833, 0xBC868CA0, +/**/ 0xCF68A77A, 0x3FD5190E, +/**/ 0x55EEF0F3, 0x3C7B3571, +/**/ 0xB680D6A5, 0x3FEE3614, +/**/ 0xAA015237, 0xBC727793, +/**/ 0x9FA2F597, 0x3FD591BC, +/**/ 0xAC3FE0CB, 0x3C67C74B, +/**/ 0x49ACD6C1, 0x3FEE20BF, +/**/ 0xC7EF636C, 0xBC5660AE, +/**/ 0x29078775, 0x3FD60A14, +/**/ 0x0BA89133, 0x3C5B1FD8, +/**/ 0x5A03DBCE, 0x3FEE0AF1, +/**/ 0x02771AE6, 0x3C5FE8E7, +/**/ 0x8A38D7F7, 0x3FD68213, +/**/ 0x02444AAD, 0xBC7D8892, +/**/ 0x3EBD875E, 0x3FEDF4AB, +/**/ 0x7E6736C4, 0xBC8E2D8A, +/**/ 0xE33A0255, 0x3FD6F9B8, +/**/ 0x4EE9DA0D, 0x3C742BC1, +/**/ 0x50F228D6, 0x3FEDDDED, +/**/ 0xD42BA2BF, 0xBC6E80C8, +/**/ 0x55764214, 0x3FD77102, +/**/ 0x314BB6CE, 0xBC66EAD7, +/**/ 0xEB995912, 0x3FEDC6B7, +/**/ 0x776DCD35, 0x3C54B364, +/**/ 0x03C86D4E, 0x3FD7E7EE, +/**/ 0xDABF5AF2, 0xBC7B63BC, +/**/ 0x6B888E83, 0x3FEDAF0B, +/**/ 0x2B5E5CEA, 0x3C8A249E, +/**/ 0x12826949, 0x3FD85E7A, +/**/ 0x9B5FACE0, 0x3C78A40E, +/**/ 0x2F71A9DC, 0x3FED96E8, +/**/ 0xD5D2039D, 0x3C8FF61B, +/**/ 0xA774992F, 0x3FD8D4A4, +/**/ 0xEA766326, 0x3C744A02, +/**/ 0x97E17B4A, 0x3FED7E4E, +/**/ 0x352BED94, 0xBC63B770, +/**/ 0xE9F546C5, 0x3FD94A6B, +/**/ 0x3E683F58, 0xBC769CE1, +/**/ 0x073E4040, 0x3FED653F, +/**/ 0x434BEC37, 0xBC876236, +/**/ 0x02E80510, 0x3FD9BFCE, +/**/ 0xA320B0A4, 0x3C709E39, +/**/ 0xE1C619E0, 0x3FED4BB9, +/**/ 0x77858F61, 0x3C8F34BB, +/**/ 0x1CC50CCA, 0x3FDA34C9, +/**/ 0x3B50CECD, 0xBC5A310E, +/**/ 0x8D8D7C06, 0x3FED31BF, +/**/ 0x3089CBDD, 0x3C7E60DD, +/**/ 0x63A09277, 0x3FDAA95B, +/**/ 0xB13C0381, 0xBC66293E, +/**/ 0x727D94F0, 0x3FED1750, +/**/ 0x1EC1A48E, 0x3C80D52B, +/**/ 0x05321617, 0x3FDB1D83, +/**/ 0xCB99F519, 0xBC7AE242, +/**/ 0xFA52AD9F, 0x3FECFC6C, +/**/ 0x508F2A0D, 0x3C88B5B5, +/**/ 0x30DBAC43, 0x3FDB913E, +/**/ 0x2F6C3FF1, 0xBC7E38AD, +/**/ 0x909A82E5, 0x3FECE115, +/**/ 0xBB31109A, 0x3C81F139, +/**/ 0x17B140A3, 0x3FDC048B, +/**/ 0x757E9FA7, 0x3C619FE6, +/**/ 0xA2B2972E, 0x3FECC54A, +/**/ 0x2BA83A98, 0x3C64EE16, +/**/ 0xEC7FD19E, 0x3FDC7767, +/**/ 0x1A3D5826, 0xBC5EB14D, +/**/ 0x9FC67D0B, 0x3FECA90C, +/**/ 0x485E3462, 0xBC646A81, +/**/ 0xE3D4A51F, 0x3FDCE9D2, +/**/ 0x12DAE298, 0xBC62FC8A, +/**/ 0xF8CE1A84, 0x3FEC8C5B, +/**/ 0xA1590123, 0x3C7AB3D1, +/**/ 0x34047661, 0x3FDD5BCA, +/**/ 0xA75FC29C, 0x3C728A44, +/**/ 0x208BE53B, 0x3FEC6F39, +/**/ 0xFBAADB42, 0xBC8741DB, +/**/ 0x15329C9A, 0x3FDDCD4C, +/**/ 0xE171FD9A, 0x3C70D4C6, +/**/ 0x8B8B175E, 0x3FEC51A4, +/**/ 0x3B9AA880, 0xBC61BBB4, +/**/ 0xC1582A69, 0x3FDE3E56, +/**/ 0x1099F88F, 0xBC50A482, +/**/ 0xB01DDD81, 0x3FEC339E, +/**/ 0xEE82C5C0, 0xBC8CAAF5, +/**/ 0x744B05F0, 0x3FDEAEE8, +/**/ 0x3C9B027D, 0xBC5789B4, +/**/ 0x065B7D50, 0x3FEC1528, +/**/ 0x1312E828, 0xBC889211, +/**/ 0x6BC4F97B, 0x3FDF1EFF, +/**/ 0xF8A7525C, 0x3C717212, +/**/ 0x081E7536, 0x3FEBF641, +/**/ 0x1628A9A1, 0x3C8B7BD7, +/**/ 0xE76ABC97, 0x3FDF8E99, +/**/ 0xAF2D00A3, 0x3C59D950, +/**/ 0x310294F5, 0x3FEBD6EA, +/**/ 0xC88C109D, 0x3C731BBC, +/**/ 0x28D2F57A, 0x3FDFFDB6, +/**/ 0x2E905B6A, 0x3C6F4A99, +/**/ 0xFE630F32, 0x3FEBB723, +/**/ 0x452D0A39, 0x3C772BD2, +/**/ 0x39C69955, 0x3FE03629, +/**/ 0x78397B01, 0xBC82D8CD, +/**/ 0xEF58840E, 0x3FEB96EE, +/**/ 0xC78FADE0, 0x3C545A3C, +/**/ 0x86946E5B, 0x3FE06D36, +/**/ 0x4538FF1B, 0x3C83F5AE, +/**/ 0x84B704C2, 0x3FEB764B, +/**/ 0xC21B389B, 0xBC8F5848, +/**/ 0x1E9E1001, 0x3FE0A402, +/**/ 0xA13914F6, 0xBC86F643, +/**/ 0x410C104E, 0x3FEB553A, +/**/ 0x47027A16, 0x3C58FF79, +/**/ 0x26B5672E, 0x3FE0DA8B, +/**/ 0xF0BEE909, 0xBC8A58DE, +/**/ 0xA89C8948, 0x3FEB33BB, +/**/ 0x1D1F6CA9, 0x3C8EA6A5, +/**/ 0xC4B69C3B, 0x3FE110D0, +/**/ 0x98809981, 0x3C8D9189, +/**/ 0x4162A4C6, 0x3FEB11D0, +/**/ 0x1EFBC0C2, 0x3C71DD56, +/**/ 0x1F8B7F82, 0x3FE146D2, +/**/ 0x5E2739A8, 0x3C7BF953, +/**/ 0x930BD275, 0x3FEAEF78, +/**/ 0x79746F94, 0xBC7F8362, +/**/ 0x5F2EEDB0, 0x3FE17C8E, +/**/ 0x102E2488, 0x3C635E57, +/**/ 0x26F69DE5, 0x3FEACCB5, +/**/ 0x8DD6B6CC, 0x3C88FB6A, +/**/ 0xACB02FDD, 0x3FE1B204, +/**/ 0x70CBB5FF, 0xBC5F190C, +/**/ 0x88308913, 0x3FEAA986, +/**/ 0x07CD5070, 0xBC0B83D6, +/**/ 0x3236574C, 0x3FE1E734, +/**/ 0xA4F41D5A, 0x3C722A3F, +/**/ 0x4373E02D, 0x3FEA85ED, +/**/ 0x385EC792, 0x3C69BE06, +/**/ 0x1B0394CF, 0x3FE21C1C, +/**/ 0x4B23AA31, 0x3C5E5B32, +/**/ 0xE72586AF, 0x3FEA61E9, +/**/ 0xE2FD453F, 0x3C858330, +/**/ 0x93788BBB, 0x3FE250BB, +/**/ 0x2457BCCE, 0x3C7EA3D0, +/**/ 0x0352BDCF, 0x3FEA3D7D, +/**/ 0xECA19669, 0xBC868DBA, +/**/ 0xC917A067, 0x3FE28511, +/**/ 0xD9A16B70, 0xBC801DF1, +/**/ 0x29AEE445, 0x3FEA18A7, +/**/ 0x736C0358, 0x3C395E25, +/**/ 0xEA88421E, 0x3FE2B91D, +/**/ 0xDB216AB0, 0xBC8FA371, +/**/ 0xED912F85, 0x3FE9F368, +/**/ 0xC5791606, 0xBC81D200, +/**/ 0x279A3082, 0x3FE2ECDF, +/**/ 0xE0E7E37E, 0x3C8D3557, +/**/ 0xE3F25E5C, 0x3FE9CDC2, +/**/ 0x12993F62, 0x3C83F991, +/**/ 0xB148BC4F, 0x3FE32054, +/**/ 0x095A135B, 0x3C8F6B42, +/**/ 0xA36A6514, 0x3FE9A7B5, +/**/ 0xCC9FA7A9, 0x3C8722CF, +/**/ 0xB9BE0367, 0x3FE3537D, +/**/ 0x7AF040F0, 0x3C6B327E, +/**/ 0xC42E1310, 0x3FE98141, +/**/ 0x0488F08D, 0x3C8D1FF8, +/**/ 0x7456282B, 0x3FE38659, +/**/ 0xA93B07A8, 0xBC710FAD, +/**/ 0xE00CB1FD, 0x3FE95A67, +/**/ 0xA21F862D, 0xBC80BEFD, +/**/ 0x15A2840A, 0x3FE3B8E7, +/**/ 0xA7D2F07B, 0xBC797653, +/**/ 0x926D9E92, 0x3FE93328, +/**/ 0x03600CDA, 0xBC8BB770, +/**/ 0xD36CD53A, 0x3FE3EB25, +/**/ 0xE1570FC0, 0xBC5BE570, +/**/ 0x784DDAF7, 0x3FE90B84, +/**/ 0x0AB93B87, 0xBC70FEB1, +/**/ 0xE4BA6790, 0x3FE41D14, +/**/ 0xD287ECF5, 0x3C84608F, +/**/ 0x303D9AD1, 0x3FE8E37C, +/**/ 0xB53D4BF8, 0xBC6463A4, +/**/ 0x81CF386B, 0x3FE44EB3, +/**/ 0x1E6A5505, 0xBC83ED6C, +/**/ 0x5A5DC900, 0x3FE8BB10, +/**/ 0x3E9474C1, 0x3C8863E0, +/**/ 0xE431159F, 0x3FE48000, +/**/ 0x7463ED10, 0xBC8B194A, +/**/ 0x985D871F, 0x3FE89241, +/**/ 0xC413ED84, 0x3C8C48D9, +/**/ 0x46AAB761, 0x3FE4B0FC, +/**/ 0x738CC59A, 0x3C20DA05, +/**/ 0x8D77A6C6, 0x3FE86910, +/**/ 0xE2BFE9DD, 0x3C7338FF, +/**/ 0xE54ED51B, 0x3FE4E1A4, +/**/ 0x89B7C76A, 0xBC8A492F, +/**/ 0xDE701CA0, 0x3FE83F7D, +/**/ 0x609BC6E8, 0xBC4152CF, +/**/ 0xFD7B351C, 0x3FE511F9, +/**/ 0x61C48831, 0xBC85C0E8, +/**/ 0x31916D5D, 0x3FE8158A, +/**/ 0x0B8228DE, 0xBC6DE8B9, +/**/ 0xCDDBB724, 0x3FE541FA, +/**/ 0x8520D391, 0x3C7232C2, +/**/ 0x2EAA1488, 0x3FE7EB36, +/**/ 0xA4A5959F, 0x3C5A1D65, +/**/ 0x966D59B3, 0x3FE571A6, +/**/ 0x4D0FB198, 0x3C5C843B, +/**/ 0x7F09E54F, 0x3FE7C082, +/**/ 0xD72AEE68, 0xBC6C73D6, +/**/ 0x98813A12, 0x3FE5A0FC, +/**/ 0xB7D4227B, 0xBC8D82E2, +/**/ 0xCD7F6543, 0x3FE7956F, +/**/ 0xE9D45AE4, 0xBC8AB276, +/**/ 0x16BF8F0D, 0x3FE5CFFC, +/**/ 0x70EB578A, 0x3C896CB3, +/**/ 0xC655211F, 0x3FE769FE, +/**/ 0xCF8C68C5, 0xBC6827D5, +/**/ 0x552A9E57, 0x3FE5FEA4, +/**/ 0xF7EE20B7, 0x3C80B6CE, +/**/ 0x174EFBA1, 0x3FE73E30, +/**/ 0x3D94AD5F, 0xBC65D3AE, +/**/ 0x9921AC79, 0x3FE62CF4, +/**/ 0x55B6241A, 0xBC8EDD98, +/**/ 0x6FA77678, 0x3FE71204, +/**/ 0xA5029C81, 0x3C8425B0, +/**/ 0x2963E755, 0x3FE65AEC, +/**/ 0x6B71053C, 0x3C8126F9, +/**/ 0x800CF55E, 0x3FE6E57C, +/**/ 0xDEDBD0A6, 0x3C860286, +/**/ 0x4E134B2F, 0x3FE6888A, +/**/ 0x7644D5E6, 0xBC86B7D3, +/**/ 0xFA9EFB5D, 0x3FE6B898, +/**/ 0x86CCF4B2, 0x3C715AC7, +/**/ 0x50B7821A, 0x3FE6B5CE, +/**/ 0x8F702E0F, 0xBC65D515, +/**/ 0x92EB6253, 0x3FE68B5A, +/**/ 0xD985F89C, 0xBC89A91A, +/**/ 0x7C40BDE1, 0x3FE6E2B7, +/**/ 0x857FAD53, 0xBC70E729, +/**/ 0xFDEB8CBA, 0x3FE65DC1, +/**/ 0x47337C77, 0xBC597C1B, +/**/ 0x1D0A8C40, 0x3FE70F45, +/**/ 0x3885770D, 0x3C697EDE, +/**/ 0xF20191C7, 0x3FE62FCF, +/**/ 0x895756EF, 0x3C6D9143, +/**/ 0x80DEA578, 0x3FE73B76, +/**/ 0x06DC12A2, 0xBC722483, +/**/ 0x26F563DF, 0x3FE60185, +/**/ 0xE0E432D0, 0x3C846CA5, +/**/ 0xF6F7B524, 0x3FE7674A, +/**/ 0x94AC84A8, 0x3C7E9D3F, +/**/ 0x55F1F17A, 0x3FE5D2E2, +/**/ 0x04C8892B, 0x3C803141, +/**/ 0xD0041D52, 0x3FE792C1, +/**/ 0xEEB354EB, 0xBC8ABF05, +/**/ 0x39824077, 0x3FE5A3E8, +/**/ 0x2759BE62, 0x3C8428AA, +/**/ 0x5E28B3C2, 0x3FE7BDDA, +/**/ 0x7CCD0393, 0x3C4AD119, +/**/ 0x8D8E83F2, 0x3FE57497, +/**/ 0xAF282D23, 0x3C8F4714, +/**/ 0xF5037959, 0x3FE7E893, +/**/ 0xAA650C4C, 0x3C80EEFB, +/**/ 0x0F592CA5, 0x3FE544F1, +/**/ 0xE6C7A62F, 0xBC8E7AE8, +/**/ 0xE9AE4BA4, 0x3FE812ED, +/**/ 0xDF402DDA, 0xBC87830A, +/**/ 0x7D7BF3DA, 0x3FE514F5, +/**/ 0x8073C259, 0x3C747A10 } }; +#endif +#endif diff --git a/libc/sysdeps/ieee754/dbl-64/slowexp.c b/libc/sysdeps/ieee754/dbl-64/slowexp.c index 78c107f70..6a6bce31b 100644 --- a/libc/sysdeps/ieee754/dbl-64/slowexp.c +++ b/libc/sysdeps/ieee754/dbl-64/slowexp.c @@ -1,7 +1,7 @@ /* * IBM Accurate Mathematical Library * written by International Business Machines Corp. - * Copyright (C) 2001 Free Software Foundation + * Copyright (C) 2001, 2011 Free Software Foundation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -31,10 +31,16 @@ #include "mpa.h" #include "math_private.h" +#ifndef SECTION +# define SECTION +#endif + void __mpexp(mp_no *x, mp_no *y, int p); /*Converting from double precision to Multi-precision and calculating e^x */ -double __slowexp(double x) { +double +SECTION +__slowexp(double x) { double w,z,res,eps=3.0e-26; #if 0 double y; @@ -47,7 +53,7 @@ double __slowexp(double x) { p=6; __dbl_mp(x,&mpx,p); /* Convert a double precision number x */ - /* into a multiple precision number mpx with prec. p. */ + /* into a multiple precision number mpx with prec. p. */ __mpexp(&mpx, &mpy, p); /* Multi-Precision exponential function */ __dbl_mp(eps,&mpeps,p); __mul(&mpeps,&mpy,&mpcor,p); diff --git a/libc/sysdeps/ieee754/dbl-64/slowpow.c b/libc/sysdeps/ieee754/dbl-64/slowpow.c index e11a532bf..0c57e6d4f 100644 --- a/libc/sysdeps/ieee754/dbl-64/slowpow.c +++ b/libc/sysdeps/ieee754/dbl-64/slowpow.c @@ -1,7 +1,7 @@ /* * IBM Accurate Mathematical Library * written by International Business Machines Corp. - * Copyright (C) 2001 Free Software Foundation + * Copyright (C) 2001, 2011 Free Software Foundation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -35,12 +35,18 @@ #include "mpa.h" #include "math_private.h" +#ifndef SECTION +# define SECTION +#endif + void __mpexp(mp_no *x, mp_no *y, int p); void __mplog(mp_no *x, mp_no *y, int p); double ulog(double); double __halfulp(double x,double y); -double __slowpow(double x, double y, double z) { +double +SECTION +__slowpow(double x, double y, double z) { double res,res1; mp_no mpx, mpy, mpz,mpw,mpp,mpr,mpr1; static const mp_no eps = {-3,{1.0,4.0}}; @@ -48,7 +54,7 @@ double __slowpow(double x, double y, double z) { res = __halfulp(x,y); /* halfulp() returns -10 or x^y */ if (res >= 0) return res; /* if result was really computed by halfulp */ - /* else, if result was not really computed by halfulp */ + /* else, if result was not really computed by halfulp */ p = 10; /* p=precision */ __dbl_mp(x,&mpx,p); __dbl_mp(y,&mpy,p); diff --git a/libc/sysdeps/ieee754/dbl-64/wordsize-64/e_fmod.c b/libc/sysdeps/ieee754/dbl-64/wordsize-64/e_fmod.c new file mode 100644 index 000000000..0e20571a7 --- /dev/null +++ b/libc/sysdeps/ieee754/dbl-64/wordsize-64/e_fmod.c @@ -0,0 +1,104 @@ +/* Rewritten for 64-bit machines by Ulrich Drepper . */ +/* + * ==================================================== + * 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_fmod(x,y) + * Return x mod y in exact arithmetic + * Method: shift and subtract + */ + +#include "math.h" +#include "math_private.h" + +static const double one = 1.0, Zero[] = {0.0, -0.0,}; + +double +__ieee754_fmod (double x, double y) +{ + int32_t n,i,ix,iy; + int64_t hx,hy,hz,sx; + + EXTRACT_WORDS64(hx,x); + EXTRACT_WORDS64(hy,y); + sx = hx&UINT64_C(0x8000000000000000); /* sign of x */ + hx ^=sx; /* |x| */ + hy &= UINT64_C(0x7fffffffffffffff); /* |y| */ + + /* purge off exception values */ + if(__builtin_expect(hy==0 + || hx >= UINT64_C(0x7ff0000000000000) + || hy > UINT64_C(0x7ff0000000000000), 0)) + /* y=0,or x not finite or y is NaN */ + return (x*y)/(x*y); + if(__builtin_expect(hx<=hy, 0)) { + if(hx>63]; /* |x|=|y| return x*0*/ + } + + /* determine ix = ilogb(x) */ + if(__builtin_expect(hx0; i<<=1) ix -=1; + } else ix = (hx>>52)-1023; + + /* determine iy = ilogb(y) */ + if(__builtin_expect(hy0; i<<=1) iy -=1; + } else iy = (hy>>52)-1023; + + /* set up hx, hy and align y to x */ + if(__builtin_expect(ix >= -1022, 1)) + hx = UINT64_C(0x0010000000000000)|(UINT64_C(0x000fffffffffffff)&hx); + else { /* subnormal x, shift x to normal */ + n = -1022-ix; + hx<<=n; + } + if(__builtin_expect(iy >= -1022, 1)) + hy = UINT64_C(0x0010000000000000)|(UINT64_C(0x000fffffffffffff)&hy); + else { /* subnormal y, shift y to normal */ + n = -1022-iy; + hy<<=n; + } + + /* fix point fmod */ + n = ix - iy; + while(n--) { + hz=hx-hy; + if(hz<0){hx = hx+hx;} + else { + if(hz==0) /* return sign(x)*0 */ + return Zero[(uint64_t)sx>>63]; + hx = hz+hz; + } + } + hz=hx-hy; + if(hz>=0) {hx=hz;} + + /* convert back to floating value and restore the sign */ + if(hx==0) /* return sign(x)*0 */ + return Zero[(uint64_t)sx>>63]; + while(hx= -1022, 1)) { /* normalize output */ + hx = ((hx-UINT64_C(0x0010000000000000))|((uint64_t)(iy+1023)<<52)); + INSERT_WORDS64(x,hx|sx); + } else { /* subnormal output */ + n = -1022 - iy; + hx>>=n; + INSERT_WORDS64(x,hx|sx); + x *= one; /* create necessary signal */ + } + return x; /* exact output */ +} +strong_alias (__ieee754_fmod, __fmod_finite) diff --git a/libc/sysdeps/ieee754/dbl-64/wordsize-64/s_ceil.c b/libc/sysdeps/ieee754/dbl-64/wordsize-64/s_ceil.c index e0e71558f..346dab799 100644 --- a/libc/sysdeps/ieee754/dbl-64/wordsize-64/s_ceil.c +++ b/libc/sysdeps/ieee754/dbl-64/wordsize-64/s_ceil.c @@ -32,18 +32,16 @@ __ceil(double x) EXTRACT_WORDS64(i0,x); j0 = ((i0>>52)&0x7ff)-0x3ff; if(j0<=51) { - if(j0<0) { /* raise inexact if x != 0 */ - if(huge+x>0.0) {/* return 0*sign(x) if |x|<1 */ - if(i0<0) {i0=INT64_C(0x8000000000000000);} - else if(i0!=0) { i0=INT64_C(0x3ff0000000000000);} - } + if(j0<0) { /* raise inexact if x != 0 */ + math_force_eval(huge+x);/* return 0*sign(x) if |x|<1 */ + if(i0<0) {i0=INT64_C(0x8000000000000000);} + else if(i0!=0) { i0=INT64_C(0x3ff0000000000000);} } else { i = INT64_C(0x000fffffffffffff)>>j0; if((i0&i)==0) return x; /* x is integral */ - if(huge+x>0.0) { /* raise inexact flag */ - if(i0>0) i0 += UINT64_C(0x0010000000000000)>>j0; - i0 &= (~i); - } + math_force_eval(huge+x); /* raise inexact flag */ + if(i0>0) i0 += UINT64_C(0x0010000000000000)>>j0; + i0 &= (~i); } } else { if(j0==0x400) return x+x; /* inf or NaN */ diff --git a/libc/sysdeps/ieee754/dbl-64/wordsize-64/s_floor.c b/libc/sysdeps/ieee754/dbl-64/wordsize-64/s_floor.c index 8b7300bb9..5df4ab52f 100644 --- a/libc/sysdeps/ieee754/dbl-64/wordsize-64/s_floor.c +++ b/libc/sysdeps/ieee754/dbl-64/wordsize-64/s_floor.c @@ -54,18 +54,16 @@ __floor (double x) int32_t j0 = ((i0>>52)&0x7ff)-0x3ff; if(__builtin_expect(j0<52, 1)) { if(j0<0) { /* raise inexact if x != 0 */ - if(huge+x>0.0) {/* return 0*sign(x) if |x|<1 */ - if(i0>=0) {i0=0;} - else if((i0&0x7fffffffffffffffl)!=0) - { i0=0xbff0000000000000l;} - } + math_force_eval(huge+x);/* return 0*sign(x) if |x|<1 */ + if(i0>=0) {i0=0;} + else if((i0&0x7fffffffffffffffl)!=0) + { i0=0xbff0000000000000l;} } else { uint64_t i = (0x000fffffffffffffl)>>j0; if((i0&i)==0) return x; /* x is integral */ - if(huge+x>0.0) { /* raise inexact flag */ - if(i0<0) i0 += (0x0010000000000000l)>>j0; - i0 &= (~i); - } + math_force_eval(huge+x); /* raise inexact flag */ + if(i0<0) i0 += (0x0010000000000000l)>>j0; + i0 &= (~i); } INSERT_WORDS64(x,i0); } else if (j0==0x400) diff --git a/libc/sysdeps/ieee754/dbl-64/wordsize-64/s_remquo.c b/libc/sysdeps/ieee754/dbl-64/wordsize-64/s_remquo.c new file mode 100644 index 000000000..011401ebc --- /dev/null +++ b/libc/sysdeps/ieee754/dbl-64/wordsize-64/s_remquo.c @@ -0,0 +1,112 @@ +/* Compute remainder and a congruent to the quotient. + Copyright (C) 1997, 2011 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 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, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + +#include "math_private.h" + + +static const double zero = 0.0; + + +double +__remquo (double x, double y, int *quo) +{ + int64_t hx, hy; + uint64_t sx, qs; + int cquo; + + EXTRACT_WORDS64 (hx, x); + EXTRACT_WORDS64 (hy, y); + sx = hx & UINT64_C(0x8000000000000000); + qs = sx ^ (hy & UINT64_C(0x8000000000000000)); + hy &= UINT64_C(0x7fffffffffffffff); + hx &= UINT64_C(0x7fffffffffffffff); + + /* Purge off exception values. */ + if (__builtin_expect (hy == 0, 0)) + return (x * y) / (x * y); /* y = 0 */ + if (__builtin_expect (hx >= UINT64_C(0x7ff0000000000000) /* x not finite */ + || hy > UINT64_C(0x7ff0000000000000), 0))/* y is NaN */ + return (x * y) / (x * y); + + if (hy <= UINT64_C(0x7fbfffffffffffff)) + x = __ieee754_fmod (x, 8 * y); /* now x < 8y */ + + if (__builtin_expect (hx == hy, 0)) + { + *quo = qs ? -1 : 1; + return zero * x; + } + + INSERT_WORDS64 (x, hx); + INSERT_WORDS64 (y, hy); + cquo = 0; + + if (x >= 4 * y) + { + x -= 4 * y; + cquo += 4; + } + if (x >= 2 * y) + { + x -= 2 * y; + cquo += 2; + } + + if (hy < UINT64_C(0x0020000000000000)) + { + if (x + x > y) + { + x -= y; + ++cquo; + if (x + x >= y) + { + x -= y; + ++cquo; + } + } + } + else + { + double y_half = 0.5 * y; + if (x > y_half) + { + x -= y; + ++cquo; + if (x >= y_half) + { + x -= y; + ++cquo; + } + } + } + + *quo = qs ? -cquo : cquo; + + if (sx) + x = -x; + return x; +} +weak_alias (__remquo, remquo) +#ifdef NO_LONG_DOUBLE +strong_alias (__remquo, __remquol) +weak_alias (__remquo, remquol) +#endif diff --git a/libc/sysdeps/ieee754/dbl-64/wordsize-64/s_round.c b/libc/sysdeps/ieee754/dbl-64/wordsize-64/s_round.c index 5bd857910..25ff85928 100644 --- a/libc/sysdeps/ieee754/dbl-64/wordsize-64/s_round.c +++ b/libc/sysdeps/ieee754/dbl-64/wordsize-64/s_round.c @@ -1,5 +1,5 @@ /* Round double to integer away from zero. - Copyright (C) 1997, 2009 Free Software Foundation, Inc. + Copyright (C) 1997, 2009, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1997. @@ -37,12 +37,11 @@ __round (double x) { if (j0 < 0) { - if (huge + x > 0.0) - { - i0 &= UINT64_C(0x8000000000000000); - if (j0 == -1) - i0 |= UINT64_C(0x3ff0000000000000); - } + math_force_eval (huge + x); + + i0 &= UINT64_C(0x8000000000000000); + if (j0 == -1) + i0 |= UINT64_C(0x3ff0000000000000); } else { @@ -50,12 +49,11 @@ __round (double x) if ((i0 & i) == 0) /* X is integral. */ return x; - if (huge + x > 0.0) - { - /* Raise inexact if x != 0. */ - i0 += UINT64_C(0x0008000000000000) >> j0; - i0 &= ~i; - } + math_force_eval (huge + x); + + /* Raise inexact if x != 0. */ + i0 += UINT64_C(0x0008000000000000) >> j0; + i0 &= ~i; } } else -- cgit v1.2.3