1996-03-05 21:41:30 +00:00
|
|
|
/*
|
2001-03-12 00:04:52 +00:00
|
|
|
* IBM Accurate Mathematical Library
|
2002-07-06 06:36:39 +00:00
|
|
|
* written by International Business Machines Corp.
|
2014-01-01 11:03:15 +00:00
|
|
|
* Copyright (C) 2001-2014 Free Software Foundation, Inc.
|
1996-03-05 21:41:30 +00:00
|
|
|
*
|
2001-03-12 00:04:52 +00:00
|
|
|
* 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
|
2002-08-26 22:40:48 +00:00
|
|
|
* the Free Software Foundation; either version 2.1 of the License, or
|
2001-03-12 00:04:52 +00:00
|
|
|
* (at your option) any later version.
|
1996-03-05 21:41:30 +00:00
|
|
|
*
|
2001-03-12 00:04:52 +00:00
|
|
|
* 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
|
2002-08-20 21:51:55 +00:00
|
|
|
* GNU Lesser General Public License for more details.
|
1996-03-05 21:41:30 +00:00
|
|
|
*
|
2001-03-12 00:04:52 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
2012-02-09 23:18:22 +00:00
|
|
|
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
1996-03-05 21:41:30 +00:00
|
|
|
*/
|
2001-03-12 00:04:52 +00:00
|
|
|
/****************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* MODULE_NAME:usncs.c */
|
|
|
|
/* */
|
|
|
|
/* FUNCTIONS: usin */
|
|
|
|
/* ucos */
|
|
|
|
/* slow */
|
|
|
|
/* slow1 */
|
|
|
|
/* slow2 */
|
|
|
|
/* sloww */
|
|
|
|
/* sloww1 */
|
|
|
|
/* sloww2 */
|
|
|
|
/* bsloww */
|
|
|
|
/* bsloww1 */
|
|
|
|
/* bsloww2 */
|
|
|
|
/* cslow2 */
|
|
|
|
/* csloww */
|
|
|
|
/* csloww1 */
|
|
|
|
/* csloww2 */
|
|
|
|
/* FILES NEEDED: dla.h endian.h mpa.h mydefs.h usncs.h */
|
|
|
|
/* branred.c sincos32.c dosincos.c mpa.c */
|
|
|
|
/* sincos.tbl */
|
|
|
|
/* */
|
|
|
|
/* An ultimate sin and routine. Given an IEEE double machine number x */
|
|
|
|
/* it computes the correctly rounded (to nearest) value of sin(x) or cos(x) */
|
|
|
|
/* Assumption: Machine arithmetic operations are performed in */
|
|
|
|
/* round to nearest mode of IEEE 754 standard. */
|
|
|
|
/* */
|
|
|
|
/****************************************************************************/
|
1996-03-05 21:41:30 +00:00
|
|
|
|
|
|
|
|
2009-04-26 01:04:54 +00:00
|
|
|
#include <errno.h>
|
2001-03-12 00:04:52 +00:00
|
|
|
#include "endian.h"
|
|
|
|
#include "mydefs.h"
|
|
|
|
#include "usncs.h"
|
|
|
|
#include "MathLib.h"
|
2012-03-09 19:29:16 +00:00
|
|
|
#include <math_private.h>
|
2012-03-02 20:51:39 +00:00
|
|
|
#include <fenv.h>
|
2001-03-12 00:04:52 +00:00
|
|
|
|
2013-09-19 15:04:45 +00:00
|
|
|
/* Helper macros to compute sin of the input values. */
|
2013-12-11 05:54:25 +00:00
|
|
|
#define POLYNOMIAL2(xx) ((((s5 * (xx) + s4) * (xx) + s3) * (xx) + s2) * (xx))
|
2013-09-19 15:04:45 +00:00
|
|
|
|
2013-12-11 05:54:25 +00:00
|
|
|
#define POLYNOMIAL(xx) (POLYNOMIAL2 (xx) + s1)
|
2013-09-19 15:04:45 +00:00
|
|
|
|
|
|
|
/* The computed polynomial is a variation of the Taylor series expansion for
|
|
|
|
sin(a):
|
|
|
|
|
|
|
|
a - a^3/3! + a^5/5! - a^7/7! + a^9/9! + (1 - a^2) * da / 2
|
|
|
|
|
|
|
|
The constants s1, s2, s3, etc. are pre-computed values of 1/3!, 1/5! and so
|
|
|
|
on. The result is returned to LHS and correction in COR. */
|
2013-12-16 14:33:04 +00:00
|
|
|
#define TAYLOR_SIN(xx, a, da, cor) \
|
2013-09-19 15:04:45 +00:00
|
|
|
({ \
|
|
|
|
double t = ((POLYNOMIAL (xx) * (a) - 0.5 * (da)) * (xx) + (da)); \
|
|
|
|
double res = (a) + t; \
|
|
|
|
(cor) = ((a) - res) + t; \
|
|
|
|
res; \
|
|
|
|
})
|
|
|
|
|
|
|
|
/* This is again a variation of the Taylor series expansion with the term
|
|
|
|
x^3/3! expanded into the following for better accuracy:
|
|
|
|
|
|
|
|
bb * x ^ 3 + 3 * aa * x * x1 * x2 + aa * x1 ^ 3 + aa * x2 ^ 3
|
|
|
|
|
|
|
|
The correction term is dx and bb + aa = -1/3!
|
|
|
|
*/
|
|
|
|
#define TAYLOR_SLOW(x0, dx, cor) \
|
|
|
|
({ \
|
|
|
|
static const double th2_36 = 206158430208.0; /* 1.5*2**37 */ \
|
|
|
|
double xx = (x0) * (x0); \
|
|
|
|
double x1 = ((x0) + th2_36) - th2_36; \
|
2013-12-11 05:54:25 +00:00
|
|
|
double y = aa * x1 * x1 * x1; \
|
2013-09-19 15:04:45 +00:00
|
|
|
double r = (x0) + y; \
|
|
|
|
double x2 = ((x0) - x1) + (dx); \
|
2013-12-11 05:54:25 +00:00
|
|
|
double t = (((POLYNOMIAL2 (xx) + bb) * xx + 3.0 * aa * x1 * x2) \
|
|
|
|
* (x0) + aa * x2 * x2 * x2 + (dx)); \
|
2013-09-19 15:04:45 +00:00
|
|
|
t = (((x0) - r) + y) + t; \
|
|
|
|
double res = r + t; \
|
|
|
|
(cor) = (r - res) + t; \
|
|
|
|
res; \
|
|
|
|
})
|
|
|
|
|
2013-09-19 11:21:01 +00:00
|
|
|
#define SINCOS_TABLE_LOOKUP(u, sn, ssn, cs, ccs) \
|
|
|
|
({ \
|
|
|
|
int4 k = u.i[LOW_HALF] << 2; \
|
|
|
|
sn = __sincostab.x[k]; \
|
|
|
|
ssn = __sincostab.x[k + 1]; \
|
|
|
|
cs = __sincostab.x[k + 2]; \
|
|
|
|
ccs = __sincostab.x[k + 3]; \
|
|
|
|
})
|
|
|
|
|
2011-10-25 04:56:33 +00:00
|
|
|
#ifndef SECTION
|
|
|
|
# define SECTION
|
|
|
|
#endif
|
|
|
|
|
2011-10-25 00:19:17 +00:00
|
|
|
extern const union
|
|
|
|
{
|
|
|
|
int4 i[880];
|
|
|
|
double x[440];
|
|
|
|
} __sincostab attribute_hidden;
|
|
|
|
|
2001-03-12 00:04:52 +00:00
|
|
|
static const double
|
2013-04-30 08:48:57 +00:00
|
|
|
sn3 = -1.66666666666664880952546298448555E-01,
|
|
|
|
sn5 = 8.33333214285722277379541354343671E-03,
|
|
|
|
cs2 = 4.99999999999999999999950396842453E-01,
|
|
|
|
cs4 = -4.16666666666664434524222570944589E-02,
|
|
|
|
cs6 = 1.38888874007937613028114285595617E-03;
|
|
|
|
|
2013-12-11 06:38:19 +00:00
|
|
|
static const double t22 = 0x1.8p22;
|
|
|
|
|
2013-04-30 08:48:57 +00:00
|
|
|
void __dubsin (double x, double dx, double w[]);
|
|
|
|
void __docos (double x, double dx, double w[]);
|
2013-10-08 06:20:17 +00:00
|
|
|
double __mpsin (double x, double dx, bool reduce_range);
|
|
|
|
double __mpcos (double x, double dx, bool reduce_range);
|
2013-04-30 08:48:57 +00:00
|
|
|
static double slow (double x);
|
|
|
|
static double slow1 (double x);
|
|
|
|
static double slow2 (double x);
|
|
|
|
static double sloww (double x, double dx, double orig);
|
2013-12-20 10:28:19 +00:00
|
|
|
static double sloww1 (double x, double dx, double orig, int m);
|
2013-04-30 08:48:57 +00:00
|
|
|
static double sloww2 (double x, double dx, double orig, int n);
|
|
|
|
static double bsloww (double x, double dx, double orig, int n);
|
|
|
|
static double bsloww1 (double x, double dx, double orig, int n);
|
|
|
|
static double bsloww2 (double x, double dx, double orig, int n);
|
|
|
|
int __branred (double x, double *a, double *aa);
|
|
|
|
static double cslow2 (double x);
|
|
|
|
static double csloww (double x, double dx, double orig);
|
2013-12-20 10:28:19 +00:00
|
|
|
static double csloww1 (double x, double dx, double orig, int m);
|
2013-04-30 08:48:57 +00:00
|
|
|
static double csloww2 (double x, double dx, double orig, int n);
|
|
|
|
|
2013-12-20 10:31:03 +00:00
|
|
|
/* Given a number partitioned into U and X such that U is an index into the
|
|
|
|
sin/cos table, this macro computes the cosine of the number by combining
|
|
|
|
the sin and cos of X (as computed by a variation of the Taylor series) with
|
|
|
|
the values looked up from the sin/cos table to get the result in RES and a
|
|
|
|
correction value in COR. */
|
|
|
|
static double
|
|
|
|
do_cos (mynumber u, double x, double *corp)
|
|
|
|
{
|
|
|
|
double xx, s, sn, ssn, c, cs, ccs, res, cor;
|
|
|
|
xx = x * x;
|
|
|
|
s = x + x * xx * (sn3 + xx * sn5);
|
|
|
|
c = xx * (cs2 + xx * (cs4 + xx * cs6));
|
|
|
|
SINCOS_TABLE_LOOKUP (u, sn, ssn, cs, ccs);
|
|
|
|
cor = (ccs - s * ssn - cs * c) - sn * s;
|
|
|
|
res = cs + cor;
|
|
|
|
cor = (cs - res) + cor;
|
|
|
|
*corp = cor;
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* A more precise variant of DO_COS where the number is partitioned into U, X
|
|
|
|
and DX. EPS is the adjustment to the correction COR. */
|
|
|
|
static double
|
|
|
|
do_cos_slow (mynumber u, double x, double dx, double eps, double *corp)
|
|
|
|
{
|
|
|
|
double xx, y, x1, x2, e1, e2, res, cor;
|
|
|
|
double s, sn, ssn, c, cs, ccs;
|
|
|
|
xx = x * x;
|
|
|
|
s = x * xx * (sn3 + xx * sn5);
|
|
|
|
c = x * dx + xx * (cs2 + xx * (cs4 + xx * cs6));
|
|
|
|
SINCOS_TABLE_LOOKUP (u, sn, ssn, cs, ccs);
|
|
|
|
x1 = (x + t22) - t22;
|
|
|
|
x2 = (x - x1) + dx;
|
|
|
|
e1 = (sn + t22) - t22;
|
|
|
|
e2 = (sn - e1) + ssn;
|
|
|
|
cor = (ccs - cs * c - e1 * x2 - e2 * x) - sn * s;
|
|
|
|
y = cs - e1 * x1;
|
|
|
|
cor = cor + ((cs - y) - e1 * x1);
|
|
|
|
res = y + cor;
|
|
|
|
cor = (y - res) + cor;
|
|
|
|
if (cor > 0)
|
|
|
|
cor = 1.0005 * cor + eps;
|
|
|
|
else
|
|
|
|
cor = 1.0005 * cor - eps;
|
|
|
|
*corp = cor;
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Given a number partitioned into U and X and DX such that U is an index into
|
|
|
|
the sin/cos table, this macro computes the sine of the number by combining
|
|
|
|
the sin and cos of X (as computed by a variation of the Taylor series) with
|
|
|
|
the values looked up from the sin/cos table to get the result in RES and a
|
|
|
|
correction value in COR. */
|
|
|
|
static double
|
|
|
|
do_sin (mynumber u, double x, double dx, double *corp)
|
|
|
|
{
|
|
|
|
double xx, s, sn, ssn, c, cs, ccs, cor, res;
|
|
|
|
xx = x * x;
|
|
|
|
s = x + (dx + x * xx * (sn3 + xx * sn5));
|
|
|
|
c = x * dx + xx * (cs2 + xx * (cs4 + xx * cs6));
|
|
|
|
SINCOS_TABLE_LOOKUP (u, sn, ssn, cs, ccs);
|
|
|
|
cor = (ssn + s * ccs - sn * c) + cs * s;
|
|
|
|
res = sn + cor;
|
|
|
|
cor = (sn - res) + cor;
|
|
|
|
*corp = cor;
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* A more precise variant of res = do_sin where the number is partitioned into U, X
|
|
|
|
and DX. EPS is the adjustment to the correction COR. */
|
|
|
|
static double
|
|
|
|
do_sin_slow (mynumber u, double x, double dx, double eps, double *corp)
|
|
|
|
{
|
|
|
|
double xx, y, x1, x2, c1, c2, res, cor;
|
|
|
|
double s, sn, ssn, c, cs, ccs;
|
|
|
|
xx = x * x;
|
|
|
|
s = x * xx * (sn3 + xx * sn5);
|
|
|
|
c = xx * (cs2 + xx * (cs4 + xx * cs6));
|
|
|
|
SINCOS_TABLE_LOOKUP (u, sn, ssn, cs, ccs);
|
|
|
|
x1 = (x + t22) - t22;
|
|
|
|
x2 = (x - x1) + dx;
|
|
|
|
c1 = (cs + t22) - t22;
|
|
|
|
c2 = (cs - c1) + ccs;
|
|
|
|
cor = (ssn + s * ccs + cs * s + c2 * x + c1 * x2 - sn * x * dx) - sn * c;
|
|
|
|
y = sn + c1 * x1;
|
|
|
|
cor = cor + ((sn - y) + c1 * x1);
|
|
|
|
res = y + cor;
|
|
|
|
cor = (y - res) + cor;
|
|
|
|
if (cor > 0)
|
|
|
|
cor = 1.0005 * cor + eps;
|
|
|
|
else
|
|
|
|
cor = 1.0005 * cor - eps;
|
|
|
|
*corp = cor;
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2013-09-19 11:15:27 +00:00
|
|
|
/* Reduce range of X and compute sin of a + da. K is the amount by which to
|
|
|
|
rotate the quadrants. This allows us to use the same routine to compute cos
|
|
|
|
by simply rotating the quadrants by 1. */
|
|
|
|
static inline double
|
|
|
|
__always_inline
|
2013-12-20 10:26:21 +00:00
|
|
|
reduce_and_compute (double x, unsigned int k)
|
2013-09-19 11:15:27 +00:00
|
|
|
{
|
2013-12-20 10:26:21 +00:00
|
|
|
double retval = 0, a, da;
|
2013-09-19 11:15:27 +00:00
|
|
|
unsigned int n = __branred (x, &a, &da);
|
|
|
|
k = (n + k) % 4;
|
|
|
|
switch (k)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
if (a * a < 0.01588)
|
|
|
|
retval = bsloww (a, da, x, n);
|
|
|
|
else
|
|
|
|
retval = bsloww1 (a, da, x, n);
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
if (a * a < 0.01588)
|
|
|
|
retval = bsloww (-a, -da, x, n);
|
|
|
|
else
|
|
|
|
retval = bsloww1 (-a, -da, x, n);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
case 3:
|
|
|
|
retval = bsloww2 (a, da, x, n);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2001-03-12 00:04:52 +00:00
|
|
|
/*******************************************************************/
|
|
|
|
/* An ultimate sin routine. Given an IEEE double machine number x */
|
|
|
|
/* it computes the correctly rounded (to nearest) value of sin(x) */
|
|
|
|
/*******************************************************************/
|
2011-10-25 04:56:33 +00:00
|
|
|
double
|
|
|
|
SECTION
|
2013-04-30 08:48:57 +00:00
|
|
|
__sin (double x)
|
|
|
|
{
|
|
|
|
double xx, res, t, cor, y, s, c, sn, ssn, cs, ccs, xn, a, da, db, eps, xn1,
|
|
|
|
xn2;
|
|
|
|
mynumber u, v;
|
|
|
|
int4 k, m, n;
|
|
|
|
double retval = 0;
|
|
|
|
|
|
|
|
SET_RESTORE_ROUND_53BIT (FE_TONEAREST);
|
|
|
|
|
|
|
|
u.x = x;
|
|
|
|
m = u.i[HIGH_HALF];
|
|
|
|
k = 0x7fffffff & m; /* no sign */
|
|
|
|
if (k < 0x3e500000) /* if x->0 =>sin(x)=x */
|
2013-09-19 11:13:53 +00:00
|
|
|
retval = x;
|
2001-03-12 00:04:52 +00:00
|
|
|
/*---------------------------- 2^-26 < |x|< 0.25 ----------------------*/
|
2013-04-30 08:48:57 +00:00
|
|
|
else if (k < 0x3fd00000)
|
|
|
|
{
|
|
|
|
xx = x * x;
|
2013-09-19 15:04:45 +00:00
|
|
|
/* Taylor series. */
|
|
|
|
t = POLYNOMIAL (xx) * (xx * x);
|
2013-04-30 08:48:57 +00:00
|
|
|
res = x + t;
|
|
|
|
cor = (x - res) + t;
|
|
|
|
retval = (res == res + 1.07 * cor) ? res : slow (x);
|
|
|
|
} /* else if (k < 0x3fd00000) */
|
2001-03-12 00:04:52 +00:00
|
|
|
/*---------------------------- 0.25<|x|< 0.855469---------------------- */
|
2013-04-30 08:48:57 +00:00
|
|
|
else if (k < 0x3feb6000)
|
|
|
|
{
|
2013-12-11 05:54:25 +00:00
|
|
|
u.x = (m > 0) ? big + x : big - x;
|
|
|
|
y = (m > 0) ? x - (u.x - big) : x + (u.x - big);
|
2013-04-30 08:48:57 +00:00
|
|
|
xx = y * y;
|
|
|
|
s = y + y * xx * (sn3 + xx * sn5);
|
|
|
|
c = xx * (cs2 + xx * (cs4 + xx * cs6));
|
2013-09-19 11:21:01 +00:00
|
|
|
SINCOS_TABLE_LOOKUP (u, sn, ssn, cs, ccs);
|
|
|
|
if (m <= 0)
|
|
|
|
{
|
|
|
|
sn = -sn;
|
|
|
|
ssn = -ssn;
|
|
|
|
}
|
2013-04-30 08:48:57 +00:00
|
|
|
cor = (ssn + s * ccs - sn * c) + cs * s;
|
|
|
|
res = sn + cor;
|
|
|
|
cor = (sn - res) + cor;
|
|
|
|
retval = (res == res + 1.096 * cor) ? res : slow1 (x);
|
|
|
|
} /* else if (k < 0x3feb6000) */
|
2001-03-12 00:04:52 +00:00
|
|
|
|
|
|
|
/*----------------------- 0.855469 <|x|<2.426265 ----------------------*/
|
2013-04-30 08:48:57 +00:00
|
|
|
else if (k < 0x400368fd)
|
|
|
|
{
|
|
|
|
|
2013-12-11 05:54:25 +00:00
|
|
|
y = (m > 0) ? hp0 - x : hp0 + x;
|
2013-04-30 08:48:57 +00:00
|
|
|
if (y >= 0)
|
|
|
|
{
|
2013-12-11 05:54:25 +00:00
|
|
|
u.x = big + y;
|
|
|
|
y = (y - (u.x - big)) + hp1;
|
2013-04-30 08:48:57 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-12-11 05:54:25 +00:00
|
|
|
u.x = big - y;
|
|
|
|
y = (-hp1) - (y + (u.x - big));
|
2013-04-30 08:48:57 +00:00
|
|
|
}
|
2013-12-20 10:31:03 +00:00
|
|
|
res = do_cos (u, y, &cor);
|
2013-04-30 08:48:57 +00:00
|
|
|
retval = (res == res + 1.020 * cor) ? ((m > 0) ? res : -res) : slow2 (x);
|
|
|
|
} /* else if (k < 0x400368fd) */
|
2001-03-12 00:04:52 +00:00
|
|
|
|
|
|
|
/*-------------------------- 2.426265<|x|< 105414350 ----------------------*/
|
2013-04-30 08:48:57 +00:00
|
|
|
else if (k < 0x419921FB)
|
|
|
|
{
|
2013-12-11 05:54:25 +00:00
|
|
|
t = (x * hpinv + toint);
|
|
|
|
xn = t - toint;
|
2013-04-30 08:48:57 +00:00
|
|
|
v.x = t;
|
2013-12-11 05:54:25 +00:00
|
|
|
y = (x - xn * mp1) - xn * mp2;
|
2013-04-30 08:48:57 +00:00
|
|
|
n = v.i[LOW_HALF] & 3;
|
2013-12-11 05:54:25 +00:00
|
|
|
da = xn * mp3;
|
2013-04-30 08:48:57 +00:00
|
|
|
a = y - da;
|
|
|
|
da = (y - a) - da;
|
|
|
|
eps = ABS (x) * 1.2e-30;
|
|
|
|
|
|
|
|
switch (n)
|
|
|
|
{ /* quarter of unit circle */
|
|
|
|
case 0:
|
|
|
|
case 2:
|
|
|
|
xx = a * a;
|
|
|
|
if (n)
|
|
|
|
{
|
|
|
|
a = -a;
|
|
|
|
da = -da;
|
|
|
|
}
|
|
|
|
if (xx < 0.01588)
|
|
|
|
{
|
2013-09-19 15:04:45 +00:00
|
|
|
/* Taylor series. */
|
2013-12-16 14:33:04 +00:00
|
|
|
res = TAYLOR_SIN (xx, a, da, cor);
|
2013-04-30 08:48:57 +00:00
|
|
|
cor = (cor > 0) ? 1.02 * cor + eps : 1.02 * cor - eps;
|
|
|
|
retval = (res == res + cor) ? res : sloww (a, da, x);
|
1996-03-05 21:41:30 +00:00
|
|
|
}
|
2013-04-30 08:48:57 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if (a > 0)
|
2013-12-20 10:28:19 +00:00
|
|
|
m = 1;
|
2001-03-12 00:04:52 +00:00
|
|
|
else
|
2013-04-30 08:48:57 +00:00
|
|
|
{
|
|
|
|
m = 0;
|
2013-12-20 10:28:19 +00:00
|
|
|
a = -a;
|
2013-12-20 10:25:34 +00:00
|
|
|
da = -da;
|
2013-04-30 08:48:57 +00:00
|
|
|
}
|
2013-12-20 10:28:19 +00:00
|
|
|
u.x = big + a;
|
|
|
|
y = a - (u.x - big);
|
2013-12-20 10:31:03 +00:00
|
|
|
res = do_sin (u, y, da, &cor);
|
2013-04-30 08:48:57 +00:00
|
|
|
cor = (cor > 0) ? 1.035 * cor + eps : 1.035 * cor - eps;
|
|
|
|
retval = ((res == res + cor) ? ((m) ? res : -res)
|
2013-12-20 10:28:19 +00:00
|
|
|
: sloww1 (a, da, x, m));
|
2001-03-12 00:04:52 +00:00
|
|
|
}
|
2013-04-30 08:48:57 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
case 3:
|
|
|
|
if (a < 0)
|
|
|
|
{
|
|
|
|
a = -a;
|
|
|
|
da = -da;
|
|
|
|
}
|
2013-12-11 05:54:25 +00:00
|
|
|
u.x = big + a;
|
|
|
|
y = a - (u.x - big) + da;
|
2013-12-20 10:31:03 +00:00
|
|
|
res = do_cos (u, y, &cor);
|
2013-04-30 08:48:57 +00:00
|
|
|
cor = (cor > 0) ? 1.025 * cor + eps : 1.025 * cor - eps;
|
|
|
|
retval = ((res == res + cor) ? ((n & 2) ? -res : res)
|
|
|
|
: sloww2 (a, da, x, n));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} /* else if (k < 0x419921FB ) */
|
2001-03-12 00:04:52 +00:00
|
|
|
|
|
|
|
/*---------------------105414350 <|x|< 281474976710656 --------------------*/
|
2013-04-30 08:48:57 +00:00
|
|
|
else if (k < 0x42F00000)
|
|
|
|
{
|
2013-12-11 05:54:25 +00:00
|
|
|
t = (x * hpinv + toint);
|
|
|
|
xn = t - toint;
|
2013-04-30 08:48:57 +00:00
|
|
|
v.x = t;
|
|
|
|
xn1 = (xn + 8.0e22) - 8.0e22;
|
|
|
|
xn2 = xn - xn1;
|
2013-12-11 05:54:25 +00:00
|
|
|
y = ((((x - xn1 * mp1) - xn1 * mp2) - xn2 * mp1) - xn2 * mp2);
|
2013-04-30 08:48:57 +00:00
|
|
|
n = v.i[LOW_HALF] & 3;
|
2013-12-11 05:54:25 +00:00
|
|
|
da = xn1 * pp3;
|
2013-04-30 08:48:57 +00:00
|
|
|
t = y - da;
|
|
|
|
da = (y - t) - da;
|
2013-12-11 05:54:25 +00:00
|
|
|
da = (da - xn2 * pp3) - xn * pp4;
|
2013-04-30 08:48:57 +00:00
|
|
|
a = t + da;
|
|
|
|
da = (t - a) + da;
|
|
|
|
eps = 1.0e-24;
|
|
|
|
|
|
|
|
switch (n)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
case 2:
|
|
|
|
xx = a * a;
|
|
|
|
if (n)
|
|
|
|
{
|
|
|
|
a = -a;
|
|
|
|
da = -da;
|
|
|
|
}
|
|
|
|
if (xx < 0.01588)
|
|
|
|
{
|
2013-09-19 15:04:45 +00:00
|
|
|
/* Taylor series. */
|
2013-12-16 14:33:04 +00:00
|
|
|
res = TAYLOR_SIN (xx, a, da, cor);
|
2013-04-30 08:48:57 +00:00
|
|
|
cor = (cor > 0) ? 1.02 * cor + eps : 1.02 * cor - eps;
|
|
|
|
retval = (res == res + cor) ? res : bsloww (a, da, x, n);
|
2001-03-12 00:04:52 +00:00
|
|
|
}
|
2013-04-30 08:48:57 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if (a > 0)
|
|
|
|
{
|
|
|
|
m = 1;
|
|
|
|
db = da;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m = 0;
|
2013-12-20 10:28:19 +00:00
|
|
|
a = -a;
|
2013-04-30 08:48:57 +00:00
|
|
|
db = -da;
|
|
|
|
}
|
2013-12-20 10:28:19 +00:00
|
|
|
u.x = big + a;
|
|
|
|
y = a - (u.x - big);
|
2013-12-20 10:31:03 +00:00
|
|
|
res = do_sin (u, y, db, &cor);
|
2013-04-30 08:48:57 +00:00
|
|
|
cor = (cor > 0) ? 1.035 * cor + eps : 1.035 * cor - eps;
|
|
|
|
retval = ((res == res + cor) ? ((m) ? res : -res)
|
|
|
|
: bsloww1 (a, da, x, n));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
case 3:
|
|
|
|
if (a < 0)
|
|
|
|
{
|
|
|
|
a = -a;
|
|
|
|
da = -da;
|
|
|
|
}
|
2013-12-11 05:54:25 +00:00
|
|
|
u.x = big + a;
|
|
|
|
y = a - (u.x - big) + da;
|
2013-12-20 10:31:03 +00:00
|
|
|
res = do_cos (u, y, &cor);
|
2013-04-30 08:48:57 +00:00
|
|
|
cor = (cor > 0) ? 1.025 * cor + eps : 1.025 * cor - eps;
|
|
|
|
retval = ((res == res + cor) ? ((n & 2) ? -res : res)
|
|
|
|
: bsloww2 (a, da, x, n));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} /* else if (k < 0x42F00000 ) */
|
2001-03-12 00:04:52 +00:00
|
|
|
|
|
|
|
/* -----------------281474976710656 <|x| <2^1024----------------------------*/
|
2013-04-30 08:48:57 +00:00
|
|
|
else if (k < 0x7ff00000)
|
2013-12-20 10:26:21 +00:00
|
|
|
retval = reduce_and_compute (x, 0);
|
2013-04-30 08:48:57 +00:00
|
|
|
|
|
|
|
/*--------------------- |x| > 2^1024 ----------------------------------*/
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (k == 0x7ff00000 && u.i[LOW_HALF] == 0)
|
|
|
|
__set_errno (EDOM);
|
|
|
|
retval = x / x;
|
|
|
|
}
|
2012-03-02 20:51:39 +00:00
|
|
|
|
2013-04-30 08:48:57 +00:00
|
|
|
return retval;
|
2001-03-12 00:04:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************/
|
|
|
|
/* An ultimate cos routine. Given an IEEE double machine number x */
|
|
|
|
/* it computes the correctly rounded (to nearest) value of cos(x) */
|
|
|
|
/*******************************************************************/
|
|
|
|
|
2011-10-25 04:56:33 +00:00
|
|
|
double
|
|
|
|
SECTION
|
2013-04-30 08:48:57 +00:00
|
|
|
__cos (double x)
|
2001-03-12 00:04:52 +00:00
|
|
|
{
|
2013-12-20 10:31:03 +00:00
|
|
|
double y, xx, res, t, cor, xn, a, da, db, eps, xn1,
|
2013-04-30 08:48:57 +00:00
|
|
|
xn2;
|
|
|
|
mynumber u, v;
|
|
|
|
int4 k, m, n;
|
2001-03-12 00:04:52 +00:00
|
|
|
|
2012-03-02 20:51:39 +00:00
|
|
|
double retval = 0;
|
|
|
|
|
2012-03-10 16:55:53 +00:00
|
|
|
SET_RESTORE_ROUND_53BIT (FE_TONEAREST);
|
2012-03-02 20:51:39 +00:00
|
|
|
|
2001-03-12 00:04:52 +00:00
|
|
|
u.x = x;
|
|
|
|
m = u.i[HIGH_HALF];
|
2013-04-30 08:48:57 +00:00
|
|
|
k = 0x7fffffff & m;
|
2001-03-12 00:04:52 +00:00
|
|
|
|
2013-09-19 11:13:53 +00:00
|
|
|
/* |x|<2^-27 => cos(x)=1 */
|
2013-04-30 08:48:57 +00:00
|
|
|
if (k < 0x3e400000)
|
2013-09-19 11:13:53 +00:00
|
|
|
retval = 1.0;
|
2013-04-30 08:48:57 +00:00
|
|
|
|
|
|
|
else if (k < 0x3feb6000)
|
|
|
|
{ /* 2^-27 < |x| < 0.855469 */
|
|
|
|
y = ABS (x);
|
2013-12-11 05:54:25 +00:00
|
|
|
u.x = big + y;
|
|
|
|
y = y - (u.x - big);
|
2013-12-20 10:31:03 +00:00
|
|
|
res = do_cos (u, y, &cor);
|
2013-04-30 08:48:57 +00:00
|
|
|
retval = (res == res + 1.020 * cor) ? res : cslow2 (x);
|
|
|
|
} /* else if (k < 0x3feb6000) */
|
|
|
|
|
|
|
|
else if (k < 0x400368fd)
|
|
|
|
{ /* 0.855469 <|x|<2.426265 */ ;
|
2013-12-11 05:54:25 +00:00
|
|
|
y = hp0 - ABS (x);
|
|
|
|
a = y + hp1;
|
|
|
|
da = (y - a) + hp1;
|
2013-04-30 08:48:57 +00:00
|
|
|
xx = a * a;
|
|
|
|
if (xx < 0.01588)
|
|
|
|
{
|
2013-12-16 14:33:04 +00:00
|
|
|
res = TAYLOR_SIN (xx, a, da, cor);
|
2013-04-30 08:48:57 +00:00
|
|
|
cor = (cor > 0) ? 1.02 * cor + 1.0e-31 : 1.02 * cor - 1.0e-31;
|
|
|
|
retval = (res == res + cor) ? res : csloww (a, da, x);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (a > 0)
|
|
|
|
{
|
|
|
|
m = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m = 0;
|
2013-12-20 10:28:19 +00:00
|
|
|
a = -a;
|
2013-12-20 10:25:34 +00:00
|
|
|
da = -da;
|
2013-04-30 08:48:57 +00:00
|
|
|
}
|
2013-12-20 10:28:19 +00:00
|
|
|
u.x = big + a;
|
|
|
|
y = a - (u.x - big);
|
2013-12-20 10:31:03 +00:00
|
|
|
res = do_sin (u, y, da, &cor);
|
2013-04-30 08:48:57 +00:00
|
|
|
cor = (cor > 0) ? 1.035 * cor + 1.0e-31 : 1.035 * cor - 1.0e-31;
|
|
|
|
retval = ((res == res + cor) ? ((m) ? res : -res)
|
2013-12-20 10:28:19 +00:00
|
|
|
: csloww1 (a, da, x, m));
|
2013-04-30 08:48:57 +00:00
|
|
|
}
|
2001-03-12 00:04:52 +00:00
|
|
|
|
2013-04-30 08:48:57 +00:00
|
|
|
} /* else if (k < 0x400368fd) */
|
2001-03-12 00:04:52 +00:00
|
|
|
|
|
|
|
|
2013-04-30 08:48:57 +00:00
|
|
|
else if (k < 0x419921FB)
|
|
|
|
{ /* 2.426265<|x|< 105414350 */
|
2013-12-11 05:54:25 +00:00
|
|
|
t = (x * hpinv + toint);
|
|
|
|
xn = t - toint;
|
2013-04-30 08:48:57 +00:00
|
|
|
v.x = t;
|
2013-12-11 05:54:25 +00:00
|
|
|
y = (x - xn * mp1) - xn * mp2;
|
2013-04-30 08:48:57 +00:00
|
|
|
n = v.i[LOW_HALF] & 3;
|
2013-12-11 05:54:25 +00:00
|
|
|
da = xn * mp3;
|
2013-04-30 08:48:57 +00:00
|
|
|
a = y - da;
|
|
|
|
da = (y - a) - da;
|
|
|
|
eps = ABS (x) * 1.2e-30;
|
|
|
|
|
|
|
|
switch (n)
|
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
case 3:
|
|
|
|
xx = a * a;
|
|
|
|
if (n == 1)
|
|
|
|
{
|
|
|
|
a = -a;
|
|
|
|
da = -da;
|
|
|
|
}
|
|
|
|
if (xx < 0.01588)
|
|
|
|
{
|
2013-12-16 14:33:04 +00:00
|
|
|
res = TAYLOR_SIN (xx, a, da, cor);
|
2013-04-30 08:48:57 +00:00
|
|
|
cor = (cor > 0) ? 1.02 * cor + eps : 1.02 * cor - eps;
|
|
|
|
retval = (res == res + cor) ? res : csloww (a, da, x);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (a > 0)
|
|
|
|
{
|
|
|
|
m = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m = 0;
|
2013-12-20 10:28:19 +00:00
|
|
|
a = -a;
|
2013-12-20 10:25:34 +00:00
|
|
|
da = -da;
|
2013-04-30 08:48:57 +00:00
|
|
|
}
|
2013-12-20 10:28:19 +00:00
|
|
|
u.x = big + a;
|
|
|
|
y = a - (u.x - big);
|
2013-12-20 10:31:03 +00:00
|
|
|
res = do_sin (u, y, da, &cor);
|
2013-04-30 08:48:57 +00:00
|
|
|
cor = (cor > 0) ? 1.035 * cor + eps : 1.035 * cor - eps;
|
|
|
|
retval = ((res == res + cor) ? ((m) ? res : -res)
|
2013-12-20 10:28:19 +00:00
|
|
|
: csloww1 (a, da, x, m));
|
2013-04-30 08:48:57 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 0:
|
|
|
|
case 2:
|
|
|
|
if (a < 0)
|
|
|
|
{
|
|
|
|
a = -a;
|
|
|
|
da = -da;
|
|
|
|
}
|
2013-12-11 05:54:25 +00:00
|
|
|
u.x = big + a;
|
|
|
|
y = a - (u.x - big) + da;
|
2013-12-20 10:31:03 +00:00
|
|
|
res = do_cos (u, y, &cor);
|
2013-04-30 08:48:57 +00:00
|
|
|
cor = (cor > 0) ? 1.025 * cor + eps : 1.025 * cor - eps;
|
|
|
|
retval = ((res == res + cor) ? ((n) ? -res : res)
|
|
|
|
: csloww2 (a, da, x, n));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} /* else if (k < 0x419921FB ) */
|
2001-03-12 00:04:52 +00:00
|
|
|
|
2013-04-30 08:48:57 +00:00
|
|
|
else if (k < 0x42F00000)
|
|
|
|
{
|
2013-12-11 05:54:25 +00:00
|
|
|
t = (x * hpinv + toint);
|
|
|
|
xn = t - toint;
|
2013-04-30 08:48:57 +00:00
|
|
|
v.x = t;
|
|
|
|
xn1 = (xn + 8.0e22) - 8.0e22;
|
|
|
|
xn2 = xn - xn1;
|
2013-12-11 05:54:25 +00:00
|
|
|
y = ((((x - xn1 * mp1) - xn1 * mp2) - xn2 * mp1) - xn2 * mp2);
|
2013-04-30 08:48:57 +00:00
|
|
|
n = v.i[LOW_HALF] & 3;
|
2013-12-11 05:54:25 +00:00
|
|
|
da = xn1 * pp3;
|
2013-04-30 08:48:57 +00:00
|
|
|
t = y - da;
|
|
|
|
da = (y - t) - da;
|
2013-12-11 05:54:25 +00:00
|
|
|
da = (da - xn2 * pp3) - xn * pp4;
|
2013-04-30 08:48:57 +00:00
|
|
|
a = t + da;
|
|
|
|
da = (t - a) + da;
|
|
|
|
eps = 1.0e-24;
|
|
|
|
|
|
|
|
switch (n)
|
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
case 3:
|
|
|
|
xx = a * a;
|
|
|
|
if (n == 1)
|
|
|
|
{
|
|
|
|
a = -a;
|
|
|
|
da = -da;
|
|
|
|
}
|
|
|
|
if (xx < 0.01588)
|
|
|
|
{
|
2013-12-16 14:33:04 +00:00
|
|
|
res = TAYLOR_SIN (xx, a, da, cor);
|
2013-04-30 08:48:57 +00:00
|
|
|
cor = (cor > 0) ? 1.02 * cor + eps : 1.02 * cor - eps;
|
|
|
|
retval = (res == res + cor) ? res : bsloww (a, da, x, n);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (a > 0)
|
|
|
|
{
|
|
|
|
m = 1;
|
|
|
|
db = da;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m = 0;
|
2013-12-20 10:28:19 +00:00
|
|
|
a = -a;
|
2013-04-30 08:48:57 +00:00
|
|
|
db = -da;
|
|
|
|
}
|
2013-12-20 10:28:19 +00:00
|
|
|
u.x = big + a;
|
|
|
|
y = a - (u.x - big);
|
2013-12-20 10:31:03 +00:00
|
|
|
res = do_sin (u, y, db, &cor);
|
2013-04-30 08:48:57 +00:00
|
|
|
cor = (cor > 0) ? 1.035 * cor + eps : 1.035 * cor - eps;
|
|
|
|
retval = ((res == res + cor) ? ((m) ? res : -res)
|
|
|
|
: bsloww1 (a, da, x, n));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 0:
|
|
|
|
case 2:
|
|
|
|
if (a < 0)
|
|
|
|
{
|
|
|
|
a = -a;
|
|
|
|
da = -da;
|
|
|
|
}
|
2013-12-11 05:54:25 +00:00
|
|
|
u.x = big + a;
|
|
|
|
y = a - (u.x - big) + da;
|
2013-12-20 10:31:03 +00:00
|
|
|
res = do_cos (u, y, &cor);
|
2013-04-30 08:48:57 +00:00
|
|
|
cor = (cor > 0) ? 1.025 * cor + eps : 1.025 * cor - eps;
|
|
|
|
retval = ((res == res + cor) ? ((n) ? -res : res)
|
|
|
|
: bsloww2 (a, da, x, n));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} /* else if (k < 0x42F00000 ) */
|
|
|
|
|
2013-09-19 11:15:27 +00:00
|
|
|
/* 281474976710656 <|x| <2^1024 */
|
2013-04-30 08:48:57 +00:00
|
|
|
else if (k < 0x7ff00000)
|
2013-12-20 10:26:21 +00:00
|
|
|
retval = reduce_and_compute (x, 1);
|
2001-03-12 00:04:52 +00:00
|
|
|
|
2013-04-30 08:48:57 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if (k == 0x7ff00000 && u.i[LOW_HALF] == 0)
|
|
|
|
__set_errno (EDOM);
|
|
|
|
retval = x / x; /* |x| > 2^1024 */
|
2001-03-12 00:04:52 +00:00
|
|
|
}
|
|
|
|
|
2012-03-02 20:51:39 +00:00
|
|
|
return retval;
|
2001-03-12 00:04:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************/
|
|
|
|
/* Routine compute sin(x) for 2^-26 < |x|< 0.25 by Taylor with more */
|
|
|
|
/* precision and if still doesn't accurate enough by mpsin or dubsin */
|
|
|
|
/************************************************************************/
|
|
|
|
|
2011-10-25 04:56:33 +00:00
|
|
|
static double
|
|
|
|
SECTION
|
2013-04-30 08:48:57 +00:00
|
|
|
slow (double x)
|
|
|
|
{
|
2013-09-19 15:04:45 +00:00
|
|
|
double res, cor, w[2];
|
|
|
|
res = TAYLOR_SLOW (x, 0, cor);
|
2013-04-30 08:48:57 +00:00
|
|
|
if (res == res + 1.0007 * cor)
|
|
|
|
return res;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
__dubsin (ABS (x), 0, w);
|
|
|
|
if (w[0] == w[0] + 1.000000001 * w[1])
|
|
|
|
return (x > 0) ? w[0] : -w[0];
|
|
|
|
else
|
2013-10-08 06:20:17 +00:00
|
|
|
return (x > 0) ? __mpsin (x, 0, false) : -__mpsin (-x, 0, false);
|
2013-04-30 08:48:57 +00:00
|
|
|
}
|
2001-03-12 00:04:52 +00:00
|
|
|
}
|
2013-04-30 08:48:57 +00:00
|
|
|
|
2001-03-12 00:04:52 +00:00
|
|
|
/*******************************************************************************/
|
2013-10-17 14:03:24 +00:00
|
|
|
/* Routine compute sin(x) for 0.25<|x|< 0.855469 by __sincostab.tbl and Taylor */
|
2001-03-12 00:04:52 +00:00
|
|
|
/* and if result still doesn't accurate enough by mpsin or dubsin */
|
|
|
|
/*******************************************************************************/
|
|
|
|
|
2011-10-25 04:56:33 +00:00
|
|
|
static double
|
|
|
|
SECTION
|
2013-04-30 08:48:57 +00:00
|
|
|
slow1 (double x)
|
|
|
|
{
|
2001-03-12 00:04:52 +00:00
|
|
|
mynumber u;
|
2013-12-20 10:31:03 +00:00
|
|
|
double w[2], y, cor, res;
|
2013-04-30 08:48:57 +00:00
|
|
|
y = ABS (x);
|
2013-12-11 05:54:25 +00:00
|
|
|
u.x = big + y;
|
|
|
|
y = y - (u.x - big);
|
2013-12-20 10:31:03 +00:00
|
|
|
res = do_sin_slow (u, y, 0, 0, &cor);
|
|
|
|
if (res == res + cor)
|
2013-04-30 08:48:57 +00:00
|
|
|
return (x > 0) ? res : -res;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
__dubsin (ABS (x), 0, w);
|
|
|
|
if (w[0] == w[0] + 1.000000005 * w[1])
|
|
|
|
return (x > 0) ? w[0] : -w[0];
|
|
|
|
else
|
2013-10-08 06:20:17 +00:00
|
|
|
return (x > 0) ? __mpsin (x, 0, false) : -__mpsin (-x, 0, false);
|
2013-04-30 08:48:57 +00:00
|
|
|
}
|
2001-03-12 00:04:52 +00:00
|
|
|
}
|
2013-04-30 08:48:57 +00:00
|
|
|
|
2001-03-12 00:04:52 +00:00
|
|
|
/**************************************************************************/
|
2011-10-25 00:19:17 +00:00
|
|
|
/* Routine compute sin(x) for 0.855469 <|x|<2.426265 by __sincostab.tbl */
|
2001-03-12 00:04:52 +00:00
|
|
|
/* and if result still doesn't accurate enough by mpsin or dubsin */
|
|
|
|
/**************************************************************************/
|
2011-10-25 04:56:33 +00:00
|
|
|
static double
|
|
|
|
SECTION
|
2013-04-30 08:48:57 +00:00
|
|
|
slow2 (double x)
|
|
|
|
{
|
2001-03-12 00:04:52 +00:00
|
|
|
mynumber u;
|
2013-12-20 10:31:03 +00:00
|
|
|
double w[2], y, y1, y2, cor, res, del;
|
2013-12-11 06:38:19 +00:00
|
|
|
|
2013-04-30 08:48:57 +00:00
|
|
|
y = ABS (x);
|
2013-12-11 05:54:25 +00:00
|
|
|
y = hp0 - y;
|
2013-04-30 08:48:57 +00:00
|
|
|
if (y >= 0)
|
|
|
|
{
|
2013-12-11 05:54:25 +00:00
|
|
|
u.x = big + y;
|
|
|
|
y = y - (u.x - big);
|
|
|
|
del = hp1;
|
2013-04-30 08:48:57 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-12-11 05:54:25 +00:00
|
|
|
u.x = big - y;
|
|
|
|
y = -(y + (u.x - big));
|
|
|
|
del = -hp1;
|
2013-04-30 08:48:57 +00:00
|
|
|
}
|
2013-12-20 10:31:03 +00:00
|
|
|
res = do_cos_slow (u, y, del, 0, &cor);
|
|
|
|
if (res == res + cor)
|
2013-04-30 08:48:57 +00:00
|
|
|
return (x > 0) ? res : -res;
|
|
|
|
else
|
|
|
|
{
|
2013-12-11 05:54:25 +00:00
|
|
|
y = ABS (x) - hp0;
|
|
|
|
y1 = y - hp1;
|
|
|
|
y2 = (y - y1) - hp1;
|
2013-04-30 08:48:57 +00:00
|
|
|
__docos (y1, y2, w);
|
|
|
|
if (w[0] == w[0] + 1.000000005 * w[1])
|
|
|
|
return (x > 0) ? w[0] : -w[0];
|
|
|
|
else
|
2013-10-08 06:20:17 +00:00
|
|
|
return (x > 0) ? __mpsin (x, 0, false) : -__mpsin (-x, 0, false);
|
2013-04-30 08:48:57 +00:00
|
|
|
}
|
2001-03-12 00:04:52 +00:00
|
|
|
}
|
2013-04-30 08:48:57 +00:00
|
|
|
|
2001-03-12 00:04:52 +00:00
|
|
|
/***************************************************************************/
|
|
|
|
/* Routine compute sin(x+dx) (Double-Length number) where x is small enough*/
|
|
|
|
/* to use Taylor series around zero and (x+dx) */
|
|
|
|
/* in first or third quarter of unit circle.Routine receive also */
|
|
|
|
/* (right argument) the original value of x for computing error of */
|
|
|
|
/* result.And if result not accurate enough routine calls mpsin1 or dubsin */
|
|
|
|
/***************************************************************************/
|
|
|
|
|
2011-10-25 04:56:33 +00:00
|
|
|
static double
|
|
|
|
SECTION
|
2013-04-30 08:48:57 +00:00
|
|
|
sloww (double x, double dx, double orig)
|
|
|
|
{
|
2013-09-19 15:04:45 +00:00
|
|
|
double y, t, res, cor, w[2], a, da, xn;
|
2013-12-16 14:33:04 +00:00
|
|
|
mynumber v;
|
2001-03-12 00:04:52 +00:00
|
|
|
int4 n;
|
2013-09-19 15:04:45 +00:00
|
|
|
res = TAYLOR_SLOW (x, dx, cor);
|
2013-12-16 14:33:04 +00:00
|
|
|
if (cor > 0)
|
|
|
|
cor = 1.0005 * cor + ABS (orig) * 3.1e-30;
|
|
|
|
else
|
|
|
|
cor = 1.0005 * cor - ABS (orig) * 3.1e-30;
|
|
|
|
|
2013-04-30 08:48:57 +00:00
|
|
|
if (res == res + cor)
|
|
|
|
return res;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
(x > 0) ? __dubsin (x, dx, w) : __dubsin (-x, -dx, w);
|
|
|
|
if (w[1] > 0)
|
|
|
|
cor = 1.000000001 * w[1] + ABS (orig) * 1.1e-30;
|
|
|
|
else
|
|
|
|
cor = 1.000000001 * w[1] - ABS (orig) * 1.1e-30;
|
|
|
|
|
|
|
|
if (w[0] == w[0] + cor)
|
|
|
|
return (x > 0) ? w[0] : -w[0];
|
|
|
|
else
|
|
|
|
{
|
2013-12-11 05:54:25 +00:00
|
|
|
t = (orig * hpinv + toint);
|
|
|
|
xn = t - toint;
|
2013-04-30 08:48:57 +00:00
|
|
|
v.x = t;
|
2013-12-11 05:54:25 +00:00
|
|
|
y = (orig - xn * mp1) - xn * mp2;
|
2013-04-30 08:48:57 +00:00
|
|
|
n = v.i[LOW_HALF] & 3;
|
2013-12-11 05:54:25 +00:00
|
|
|
da = xn * pp3;
|
2013-04-30 08:48:57 +00:00
|
|
|
t = y - da;
|
|
|
|
da = (y - t) - da;
|
2013-12-11 05:54:25 +00:00
|
|
|
y = xn * pp4;
|
2013-04-30 08:48:57 +00:00
|
|
|
a = t - y;
|
|
|
|
da = ((t - a) - y) + da;
|
|
|
|
if (n & 2)
|
|
|
|
{
|
|
|
|
a = -a;
|
|
|
|
da = -da;
|
|
|
|
}
|
|
|
|
(a > 0) ? __dubsin (a, da, w) : __dubsin (-a, -da, w);
|
|
|
|
if (w[1] > 0)
|
|
|
|
cor = 1.000000001 * w[1] + ABS (orig) * 1.1e-40;
|
|
|
|
else
|
|
|
|
cor = 1.000000001 * w[1] - ABS (orig) * 1.1e-40;
|
|
|
|
|
|
|
|
if (w[0] == w[0] + cor)
|
|
|
|
return (a > 0) ? w[0] : -w[0];
|
|
|
|
else
|
2013-10-08 06:20:17 +00:00
|
|
|
return __mpsin (orig, 0, true);
|
2013-04-30 08:48:57 +00:00
|
|
|
}
|
2001-03-12 00:04:52 +00:00
|
|
|
}
|
|
|
|
}
|
2013-04-30 08:48:57 +00:00
|
|
|
|
2001-03-12 00:04:52 +00:00
|
|
|
/***************************************************************************/
|
|
|
|
/* Routine compute sin(x+dx) (Double-Length number) where x in first or */
|
|
|
|
/* third quarter of unit circle.Routine receive also (right argument) the */
|
|
|
|
/* original value of x for computing error of result.And if result not */
|
|
|
|
/* accurate enough routine calls mpsin1 or dubsin */
|
|
|
|
/***************************************************************************/
|
|
|
|
|
2011-10-25 04:56:33 +00:00
|
|
|
static double
|
|
|
|
SECTION
|
2013-12-20 10:28:19 +00:00
|
|
|
sloww1 (double x, double dx, double orig, int m)
|
2013-04-30 08:48:57 +00:00
|
|
|
{
|
2001-03-12 00:04:52 +00:00
|
|
|
mynumber u;
|
2013-12-20 10:31:03 +00:00
|
|
|
double w[2], y, cor, res;
|
2013-04-30 08:48:57 +00:00
|
|
|
|
2013-12-20 10:28:19 +00:00
|
|
|
u.x = big + x;
|
|
|
|
y = x - (u.x - big);
|
2013-12-20 10:31:03 +00:00
|
|
|
res = do_sin_slow (u, y, dx, 3.1e-30 * ABS (orig), &cor);
|
2013-04-30 08:48:57 +00:00
|
|
|
|
|
|
|
if (res == res + cor)
|
2013-12-20 10:28:19 +00:00
|
|
|
return (m > 0) ? res : -res;
|
2013-04-30 08:48:57 +00:00
|
|
|
else
|
|
|
|
{
|
2013-12-20 10:28:19 +00:00
|
|
|
__dubsin (x, dx, w);
|
2013-04-30 08:48:57 +00:00
|
|
|
|
|
|
|
if (w[1] > 0)
|
|
|
|
cor = 1.000000005 * w[1] + 1.1e-30 * ABS (orig);
|
|
|
|
else
|
|
|
|
cor = 1.000000005 * w[1] - 1.1e-30 * ABS (orig);
|
|
|
|
|
|
|
|
if (w[0] == w[0] + cor)
|
2013-12-20 10:28:19 +00:00
|
|
|
return (m > 0) ? w[0] : -w[0];
|
2013-04-30 08:48:57 +00:00
|
|
|
else
|
2013-10-08 06:20:17 +00:00
|
|
|
return __mpsin (orig, 0, true);
|
2013-04-30 08:48:57 +00:00
|
|
|
}
|
2001-03-12 00:04:52 +00:00
|
|
|
}
|
2013-04-30 08:48:57 +00:00
|
|
|
|
2001-03-12 00:04:52 +00:00
|
|
|
/***************************************************************************/
|
|
|
|
/* Routine compute sin(x+dx) (Double-Length number) where x in second or */
|
|
|
|
/* fourth quarter of unit circle.Routine receive also the original value */
|
|
|
|
/* and quarter(n= 1or 3)of x for computing error of result.And if result not*/
|
|
|
|
/* accurate enough routine calls mpsin1 or dubsin */
|
|
|
|
/***************************************************************************/
|
|
|
|
|
2011-10-25 04:56:33 +00:00
|
|
|
static double
|
|
|
|
SECTION
|
2013-04-30 08:48:57 +00:00
|
|
|
sloww2 (double x, double dx, double orig, int n)
|
|
|
|
{
|
2001-03-12 00:04:52 +00:00
|
|
|
mynumber u;
|
2013-12-20 10:31:03 +00:00
|
|
|
double w[2], y, cor, res;
|
2013-04-30 08:48:57 +00:00
|
|
|
|
2013-12-20 10:25:34 +00:00
|
|
|
u.x = big + x;
|
|
|
|
y = x - (u.x - big);
|
2013-12-20 10:31:03 +00:00
|
|
|
res = do_cos_slow (u, y, dx, 3.1e-30 * ABS (orig), &cor);
|
2013-04-30 08:48:57 +00:00
|
|
|
|
|
|
|
if (res == res + cor)
|
|
|
|
return (n & 2) ? -res : res;
|
|
|
|
else
|
|
|
|
{
|
2013-12-20 10:25:34 +00:00
|
|
|
__docos (x, dx, w);
|
2013-04-30 08:48:57 +00:00
|
|
|
|
|
|
|
if (w[1] > 0)
|
|
|
|
cor = 1.000000005 * w[1] + 1.1e-30 * ABS (orig);
|
|
|
|
else
|
|
|
|
cor = 1.000000005 * w[1] - 1.1e-30 * ABS (orig);
|
|
|
|
|
|
|
|
if (w[0] == w[0] + cor)
|
|
|
|
return (n & 2) ? -w[0] : w[0];
|
|
|
|
else
|
2013-10-08 06:20:17 +00:00
|
|
|
return __mpsin (orig, 0, true);
|
2013-04-30 08:48:57 +00:00
|
|
|
}
|
2001-03-12 00:04:52 +00:00
|
|
|
}
|
2013-04-30 08:48:57 +00:00
|
|
|
|
2001-03-12 00:04:52 +00:00
|
|
|
/***************************************************************************/
|
|
|
|
/* Routine compute sin(x+dx) or cos(x+dx) (Double-Length number) where x */
|
|
|
|
/* is small enough to use Taylor series around zero and (x+dx) */
|
|
|
|
/* in first or third quarter of unit circle.Routine receive also */
|
|
|
|
/* (right argument) the original value of x for computing error of */
|
|
|
|
/* result.And if result not accurate enough routine calls other routines */
|
|
|
|
/***************************************************************************/
|
|
|
|
|
2011-10-25 04:56:33 +00:00
|
|
|
static double
|
|
|
|
SECTION
|
2013-04-30 08:48:57 +00:00
|
|
|
bsloww (double x, double dx, double orig, int n)
|
|
|
|
{
|
2013-09-19 15:04:45 +00:00
|
|
|
double res, cor, w[2];
|
|
|
|
|
|
|
|
res = TAYLOR_SLOW (x, dx, cor);
|
2013-04-30 08:48:57 +00:00
|
|
|
cor = (cor > 0) ? 1.0005 * cor + 1.1e-24 : 1.0005 * cor - 1.1e-24;
|
|
|
|
if (res == res + cor)
|
|
|
|
return res;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
(x > 0) ? __dubsin (x, dx, w) : __dubsin (-x, -dx, w);
|
|
|
|
if (w[1] > 0)
|
|
|
|
cor = 1.000000001 * w[1] + 1.1e-24;
|
|
|
|
else
|
|
|
|
cor = 1.000000001 * w[1] - 1.1e-24;
|
|
|
|
if (w[0] == w[0] + cor)
|
|
|
|
return (x > 0) ? w[0] : -w[0];
|
|
|
|
else
|
2013-10-08 06:20:17 +00:00
|
|
|
return (n & 1) ? __mpcos (orig, 0, true) : __mpsin (orig, 0, true);
|
2013-04-30 08:48:57 +00:00
|
|
|
}
|
2001-03-12 00:04:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/***************************************************************************/
|
|
|
|
/* Routine compute sin(x+dx) or cos(x+dx) (Double-Length number) where x */
|
|
|
|
/* in first or third quarter of unit circle.Routine receive also */
|
|
|
|
/* (right argument) the original value of x for computing error of result.*/
|
|
|
|
/* And if result not accurate enough routine calls other routines */
|
|
|
|
/***************************************************************************/
|
|
|
|
|
2011-10-25 04:56:33 +00:00
|
|
|
static double
|
|
|
|
SECTION
|
2013-04-30 08:48:57 +00:00
|
|
|
bsloww1 (double x, double dx, double orig, int n)
|
|
|
|
{
|
|
|
|
mynumber u;
|
2013-12-20 10:31:03 +00:00
|
|
|
double w[2], y, cor, res;
|
2013-04-30 08:48:57 +00:00
|
|
|
|
|
|
|
y = ABS (x);
|
2013-12-11 05:54:25 +00:00
|
|
|
u.x = big + y;
|
|
|
|
y = y - (u.x - big);
|
2013-04-30 08:48:57 +00:00
|
|
|
dx = (x > 0) ? dx : -dx;
|
2013-12-20 10:31:03 +00:00
|
|
|
res = do_sin_slow (u, y, dx, 1.1e-24, &cor);
|
2013-04-30 08:48:57 +00:00
|
|
|
if (res == res + cor)
|
|
|
|
return (x > 0) ? res : -res;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
__dubsin (ABS (x), dx, w);
|
|
|
|
|
|
|
|
if (w[1] > 0)
|
|
|
|
cor = 1.000000005 * w[1] + 1.1e-24;
|
|
|
|
else
|
|
|
|
cor = 1.000000005 * w[1] - 1.1e-24;
|
|
|
|
|
|
|
|
if (w[0] == w[0] + cor)
|
|
|
|
return (x > 0) ? w[0] : -w[0];
|
|
|
|
else
|
2013-10-08 06:20:17 +00:00
|
|
|
return (n & 1) ? __mpcos (orig, 0, true) : __mpsin (orig, 0, true);
|
2013-04-30 08:48:57 +00:00
|
|
|
}
|
2001-03-12 00:04:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/***************************************************************************/
|
|
|
|
/* Routine compute sin(x+dx) or cos(x+dx) (Double-Length number) where x */
|
|
|
|
/* in second or fourth quarter of unit circle.Routine receive also the */
|
|
|
|
/* original value and quarter(n= 1or 3)of x for computing error of result. */
|
|
|
|
/* And if result not accurate enough routine calls other routines */
|
|
|
|
/***************************************************************************/
|
|
|
|
|
2011-10-25 04:56:33 +00:00
|
|
|
static double
|
|
|
|
SECTION
|
2013-04-30 08:48:57 +00:00
|
|
|
bsloww2 (double x, double dx, double orig, int n)
|
|
|
|
{
|
|
|
|
mynumber u;
|
2013-12-20 10:31:03 +00:00
|
|
|
double w[2], y, cor, res;
|
2013-04-30 08:48:57 +00:00
|
|
|
|
|
|
|
y = ABS (x);
|
2013-12-11 05:54:25 +00:00
|
|
|
u.x = big + y;
|
|
|
|
y = y - (u.x - big);
|
2013-04-30 08:48:57 +00:00
|
|
|
dx = (x > 0) ? dx : -dx;
|
2013-12-20 10:31:03 +00:00
|
|
|
res = do_cos_slow (u, y, dx, 1.1e-24, &cor);
|
2013-04-30 08:48:57 +00:00
|
|
|
if (res == res + cor)
|
|
|
|
return (n & 2) ? -res : res;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
__docos (ABS (x), dx, w);
|
|
|
|
|
|
|
|
if (w[1] > 0)
|
|
|
|
cor = 1.000000005 * w[1] + 1.1e-24;
|
|
|
|
else
|
|
|
|
cor = 1.000000005 * w[1] - 1.1e-24;
|
|
|
|
|
|
|
|
if (w[0] == w[0] + cor)
|
|
|
|
return (n & 2) ? -w[0] : w[0];
|
|
|
|
else
|
2013-10-08 06:20:17 +00:00
|
|
|
return (n & 1) ? __mpsin (orig, 0, true) : __mpcos (orig, 0, true);
|
2013-04-30 08:48:57 +00:00
|
|
|
}
|
2001-03-12 00:04:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************/
|
|
|
|
/* Routine compute cos(x) for 2^-27 < |x|< 0.25 by Taylor with more */
|
|
|
|
/* precision and if still doesn't accurate enough by mpcos or docos */
|
|
|
|
/************************************************************************/
|
|
|
|
|
2011-10-25 04:56:33 +00:00
|
|
|
static double
|
|
|
|
SECTION
|
2013-04-30 08:48:57 +00:00
|
|
|
cslow2 (double x)
|
|
|
|
{
|
2001-03-12 00:04:52 +00:00
|
|
|
mynumber u;
|
2013-12-20 10:31:03 +00:00
|
|
|
double w[2], y, cor, res;
|
2013-04-30 08:48:57 +00:00
|
|
|
|
|
|
|
y = ABS (x);
|
2013-12-11 05:54:25 +00:00
|
|
|
u.x = big + y;
|
|
|
|
y = y - (u.x - big);
|
2013-12-20 10:31:03 +00:00
|
|
|
res = do_cos_slow (u, y, 0, 0, &cor);
|
|
|
|
if (res == res + cor)
|
2001-03-12 00:04:52 +00:00
|
|
|
return res;
|
2013-04-30 08:48:57 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
y = ABS (x);
|
|
|
|
__docos (y, 0, w);
|
|
|
|
if (w[0] == w[0] + 1.000000005 * w[1])
|
|
|
|
return w[0];
|
|
|
|
else
|
2013-10-08 06:20:17 +00:00
|
|
|
return __mpcos (x, 0, false);
|
2013-04-30 08:48:57 +00:00
|
|
|
}
|
2001-03-12 00:04:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/***************************************************************************/
|
|
|
|
/* Routine compute cos(x+dx) (Double-Length number) where x is small enough*/
|
|
|
|
/* to use Taylor series around zero and (x+dx) .Routine receive also */
|
|
|
|
/* (right argument) the original value of x for computing error of */
|
|
|
|
/* result.And if result not accurate enough routine calls other routines */
|
|
|
|
/***************************************************************************/
|
|
|
|
|
|
|
|
|
2011-10-25 04:56:33 +00:00
|
|
|
static double
|
|
|
|
SECTION
|
2013-04-30 08:48:57 +00:00
|
|
|
csloww (double x, double dx, double orig)
|
|
|
|
{
|
2013-09-19 15:04:45 +00:00
|
|
|
double y, t, res, cor, w[2], a, da, xn;
|
2013-12-16 14:33:04 +00:00
|
|
|
mynumber v;
|
2001-03-12 00:04:52 +00:00
|
|
|
int4 n;
|
2013-04-30 08:48:57 +00:00
|
|
|
|
|
|
|
/* Taylor series */
|
2013-12-27 02:27:46 +00:00
|
|
|
res = TAYLOR_SLOW (x, dx, cor);
|
2013-04-30 08:48:57 +00:00
|
|
|
|
|
|
|
if (cor > 0)
|
|
|
|
cor = 1.0005 * cor + ABS (orig) * 3.1e-30;
|
|
|
|
else
|
|
|
|
cor = 1.0005 * cor - ABS (orig) * 3.1e-30;
|
|
|
|
|
|
|
|
if (res == res + cor)
|
|
|
|
return res;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
(x > 0) ? __dubsin (x, dx, w) : __dubsin (-x, -dx, w);
|
|
|
|
|
|
|
|
if (w[1] > 0)
|
|
|
|
cor = 1.000000001 * w[1] + ABS (orig) * 1.1e-30;
|
|
|
|
else
|
|
|
|
cor = 1.000000001 * w[1] - ABS (orig) * 1.1e-30;
|
|
|
|
|
|
|
|
if (w[0] == w[0] + cor)
|
|
|
|
return (x > 0) ? w[0] : -w[0];
|
|
|
|
else
|
|
|
|
{
|
2013-12-11 05:54:25 +00:00
|
|
|
t = (orig * hpinv + toint);
|
|
|
|
xn = t - toint;
|
2013-04-30 08:48:57 +00:00
|
|
|
v.x = t;
|
2013-12-11 05:54:25 +00:00
|
|
|
y = (orig - xn * mp1) - xn * mp2;
|
2013-04-30 08:48:57 +00:00
|
|
|
n = v.i[LOW_HALF] & 3;
|
2013-12-11 05:54:25 +00:00
|
|
|
da = xn * pp3;
|
2013-04-30 08:48:57 +00:00
|
|
|
t = y - da;
|
|
|
|
da = (y - t) - da;
|
2013-12-11 05:54:25 +00:00
|
|
|
y = xn * pp4;
|
2013-04-30 08:48:57 +00:00
|
|
|
a = t - y;
|
|
|
|
da = ((t - a) - y) + da;
|
|
|
|
if (n == 1)
|
|
|
|
{
|
|
|
|
a = -a;
|
|
|
|
da = -da;
|
|
|
|
}
|
|
|
|
(a > 0) ? __dubsin (a, da, w) : __dubsin (-a, -da, w);
|
|
|
|
|
|
|
|
if (w[1] > 0)
|
|
|
|
cor = 1.000000001 * w[1] + ABS (orig) * 1.1e-40;
|
|
|
|
else
|
|
|
|
cor = 1.000000001 * w[1] - ABS (orig) * 1.1e-40;
|
|
|
|
|
|
|
|
if (w[0] == w[0] + cor)
|
|
|
|
return (a > 0) ? w[0] : -w[0];
|
|
|
|
else
|
2013-10-08 06:20:17 +00:00
|
|
|
return __mpcos (orig, 0, true);
|
2013-04-30 08:48:57 +00:00
|
|
|
}
|
2001-03-12 00:04:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/***************************************************************************/
|
|
|
|
/* Routine compute sin(x+dx) (Double-Length number) where x in first or */
|
|
|
|
/* third quarter of unit circle.Routine receive also (right argument) the */
|
|
|
|
/* original value of x for computing error of result.And if result not */
|
|
|
|
/* accurate enough routine calls other routines */
|
|
|
|
/***************************************************************************/
|
|
|
|
|
2011-10-25 04:56:33 +00:00
|
|
|
static double
|
|
|
|
SECTION
|
2013-12-20 10:28:19 +00:00
|
|
|
csloww1 (double x, double dx, double orig, int m)
|
2013-04-30 08:48:57 +00:00
|
|
|
{
|
2001-03-12 00:04:52 +00:00
|
|
|
mynumber u;
|
2013-12-20 10:31:03 +00:00
|
|
|
double w[2], y, cor, res;
|
2013-04-30 08:48:57 +00:00
|
|
|
|
2013-12-20 10:28:19 +00:00
|
|
|
u.x = big + x;
|
|
|
|
y = x - (u.x - big);
|
2013-12-20 10:31:03 +00:00
|
|
|
res = do_sin_slow (u, y, dx, 3.1e-30 * ABS (orig), &cor);
|
2013-04-30 08:48:57 +00:00
|
|
|
|
|
|
|
if (res == res + cor)
|
2013-12-20 10:28:19 +00:00
|
|
|
return (m > 0) ? res : -res;
|
2013-04-30 08:48:57 +00:00
|
|
|
else
|
|
|
|
{
|
2013-12-20 10:28:19 +00:00
|
|
|
__dubsin (x, dx, w);
|
2013-04-30 08:48:57 +00:00
|
|
|
if (w[1] > 0)
|
|
|
|
cor = 1.000000005 * w[1] + 1.1e-30 * ABS (orig);
|
|
|
|
else
|
|
|
|
cor = 1.000000005 * w[1] - 1.1e-30 * ABS (orig);
|
|
|
|
if (w[0] == w[0] + cor)
|
2013-12-20 10:28:19 +00:00
|
|
|
return (m > 0) ? w[0] : -w[0];
|
2013-04-30 08:48:57 +00:00
|
|
|
else
|
2013-10-08 06:20:17 +00:00
|
|
|
return __mpcos (orig, 0, true);
|
2013-04-30 08:48:57 +00:00
|
|
|
}
|
2001-03-12 00:04:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***************************************************************************/
|
|
|
|
/* Routine compute sin(x+dx) (Double-Length number) where x in second or */
|
|
|
|
/* fourth quarter of unit circle.Routine receive also the original value */
|
|
|
|
/* and quarter(n= 1or 3)of x for computing error of result.And if result not*/
|
|
|
|
/* accurate enough routine calls other routines */
|
|
|
|
/***************************************************************************/
|
|
|
|
|
2011-10-25 04:56:33 +00:00
|
|
|
static double
|
|
|
|
SECTION
|
2013-04-30 08:48:57 +00:00
|
|
|
csloww2 (double x, double dx, double orig, int n)
|
|
|
|
{
|
2001-03-12 00:04:52 +00:00
|
|
|
mynumber u;
|
2013-12-20 10:31:03 +00:00
|
|
|
double w[2], y, cor, res;
|
2013-04-30 08:48:57 +00:00
|
|
|
|
2013-12-20 10:25:34 +00:00
|
|
|
u.x = big + x;
|
|
|
|
y = x - (u.x - big);
|
2013-12-20 10:31:03 +00:00
|
|
|
res = do_cos_slow (u, y, dx, 3.1e-30 * ABS (orig), &cor);
|
2013-04-30 08:48:57 +00:00
|
|
|
|
|
|
|
if (res == res + cor)
|
|
|
|
return (n) ? -res : res;
|
|
|
|
else
|
|
|
|
{
|
2013-12-20 10:25:34 +00:00
|
|
|
__docos (x, dx, w);
|
2013-04-30 08:48:57 +00:00
|
|
|
if (w[1] > 0)
|
|
|
|
cor = 1.000000005 * w[1] + 1.1e-30 * ABS (orig);
|
|
|
|
else
|
|
|
|
cor = 1.000000005 * w[1] - 1.1e-30 * ABS (orig);
|
|
|
|
if (w[0] == w[0] + cor)
|
|
|
|
return (n) ? -w[0] : w[0];
|
|
|
|
else
|
2013-10-08 06:20:17 +00:00
|
|
|
return __mpcos (orig, 0, true);
|
2013-04-30 08:48:57 +00:00
|
|
|
}
|
2001-03-12 00:04:52 +00:00
|
|
|
}
|
|
|
|
|
2011-10-25 00:19:17 +00:00
|
|
|
#ifndef __cos
|
2001-03-13 02:01:34 +00:00
|
|
|
weak_alias (__cos, cos)
|
2011-10-25 00:19:17 +00:00
|
|
|
# ifdef NO_LONG_DOUBLE
|
|
|
|
strong_alias (__cos, __cosl)
|
|
|
|
weak_alias (__cos, cosl)
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
#ifndef __sin
|
2001-03-13 02:01:34 +00:00
|
|
|
weak_alias (__sin, sin)
|
2011-10-25 00:19:17 +00:00
|
|
|
# ifdef NO_LONG_DOUBLE
|
2001-03-13 02:01:34 +00:00
|
|
|
strong_alias (__sin, __sinl)
|
|
|
|
weak_alias (__sin, sinl)
|
2011-10-25 00:19:17 +00:00
|
|
|
# endif
|
update from main archive 961005
Sun Oct 6 02:05:52 1996 Ulrich Drepper <drepper@cygnus.com>
* posix/getopt.c: Add casts to prevent warnings.
* posix/regex.c: Likewise.
* math/Makefile (long-m-routines, long-m-yes): Define to correct
values to make `long double' functions available.
(distribute): Add $(long-m-yes:=.c).
* sysdeps/libm-i387/s_ceill.S: Correct loading of return value.
Use long double instruction.
* sysdeps/libm-ieee754/e_atanhl.c (huge): Correct constant.
* sysdeps/libm-ieee754/e_asinhl.c: Likewise.
* sysdeps/libm-ieee754/s_tanhl.c: Likewise.
* sysdeps/libm-ieee754/e_coshl.c: New file.
* sysdeps/libm-ieee754/s_asinh.c [!NO_LONG_DOUBLE]: Define names
for `long double' version as alias.
* sysdeps/libm-ieee754/s_atan.c: Likewise.
* sysdeps/libm-ieee754/s_cbrt.c: Likewise.
* sysdeps/libm-ieee754/s_ceil.c: Likewise.
* sysdeps/libm-ieee754/s_copysign.c: Likewise.
* sysdeps/libm-ieee754/s_cos.c: Likewise.
* sysdeps/libm-ieee754/s_erf.c: Likewise.
* sysdeps/libm-ieee754/s_expm1.c: Likewise.
* sysdeps/libm-ieee754/s_fabs.c: Likewise.
* sysdeps/libm-ieee754/s_finite.c: Likewise.
* sysdeps/libm-ieee754/s_floor.c: Likewise.
* sysdeps/libm-ieee754/s_frexp.c: Likewise.
* sysdeps/libm-ieee754/s_ilogb.c: Likewise.
* sysdeps/libm-ieee754/s_ldexp.c: Likewise.
* sysdeps/libm-ieee754/s_log1p.c: Likewise.
* sysdeps/libm-ieee754/s_logb.c: Likewise.
* sysdeps/libm-ieee754/s_modf.c: Likewise.
* sysdeps/libm-ieee754/s_nextafter.c: Likewise.
* sysdeps/libm-ieee754/s_rint.c: Likewise.
* sysdeps/libm-ieee754/s_scalbn.c: Likewise.
* sysdeps/libm-ieee754/s_significand.c: Likewise.
* sysdeps/libm-ieee754/s_sin.c: Likewise.
* sysdeps/libm-ieee754/s_tan.c: Likewise.
* sysdeps/libm-ieee754/s_tanh.c: Likewise.
* sysdeps/libm-ieee754/w_acos.c: Likewise.
* sysdeps/libm-ieee754/w_acosh.c: Likewise.
* sysdeps/libm-ieee754/w_sin.c: Likewise.
* sysdeps/libm-ieee754/w_atan2.c: Likewise.
* sysdeps/libm-ieee754/w_atanh.c: Likewise.
* sysdeps/libm-ieee754/w_cabs.c: Likewise.
* sysdeps/libm-ieee754/w_cosh.c: Likewise.
* sysdeps/libm-ieee754/w_drem.c: Likewise.
* sysdeps/libm-ieee754/w_exp.c: Likewise.
* sysdeps/libm-ieee754/w_fmod.c: Likewise.
* sysdeps/libm-ieee754/w_gamma.c: Likewise.
* sysdeps/libm-ieee754/w_gamma_r.c: Likewise.
* sysdeps/libm-ieee754/w_hypot.c: Likewise.
* sysdeps/libm-ieee754/w_j0.c: Likewise.
* sysdeps/libm-ieee754/w_j1.c: Likewise.
* sysdeps/libm-ieee754/w_jn.c: Likewise.
* sysdeps/libm-ieee754/w_lgamma.c: Likewise.
* sysdeps/libm-ieee754/w_lgamma_r.c: Likewise.
* sysdeps/libm-ieee754/w_log.c: Likewise.
* sysdeps/libm-ieee754/w_log10.c: Likewise.
* sysdeps/libm-ieee754/w_pow.c: Likewise.
* sysdeps/libm-ieee754/w_remainder.c: Likewise.
* sysdeps/libm-ieee754/w_scalb.c: Likewise.
* sysdeps/libm-ieee754/w_sinh.c: Likewise.
* sysdeps/libm-ieee754/w_sqrt.c: Likewise.
Stub files for missing long double math functions.
* sysdeps/stub/e_acoshl.c: New file.
* sysdeps/stub/e_hypotl.c: New file.
* sysdeps/stub/e_j0l.c: New file.
* sysdeps/stub/e_j1l.c: New file.
* sysdeps/stub/e_jnl.c: New file.
* sysdeps/stub/e_lgammal_r.c: New file.
* sysdeps/stub/e_powl.c: New file.
* sysdeps/stub/e_rem_pio2l.c: New file.
* sysdeps/stub/e_sinhl.c: New file.
* sysdeps/stub/k_cosl.c: New file.
* sysdeps/stub/k_rem_pio2l.c: New file.
* sysdeps/stub/k_sinl.c: New file.
* sysdeps/stub/k_tanl.c: New file.
* sysdeps/stub/s_erfl.c: New file.
* sysdeps/stub/s_expm1l.c: New file.
* sysdeps/i386/__longjmp.S: Use PSEUDO_END macro to provide
.size directive.
* sysdeps/i386/bsd-_setjmp.S: Likewise.
* sysdeps/i386/bsd-setjmp.S: Likewise.
* sysdeps/i386/memchr.S: Likewise.
* sysdeps/i386/memcmp.S: Likewise.
* sysdeps/i386/setjmp.S: Likewise.
* sysdeps/i386/stpcpy.S: Likewise.
* sysdeps/i386/stpncpy.S: Likewise.
* sysdeps/i386/strchr.S: Likewise.
* sysdeps/i386/strcspn.S: Likewise.
* sysdeps/i386/strpbrk.S: Likewise.
* sysdeps/i386/strrchr.S: Likewise.
* sysdeps/i386/strspn.S: Likewise.
* sysdeps/i386/strtok.S: Likewise.
* sysdeps/i386/i486/strcat.S: Likewise.
* sysdeps/i386/i486/strlen.S: Likewise.
* sysdeps/i386/i586/memset.S: Likewise.
* sysdeps/i386/i586/strchr.S: Likewise.
* sysdeps/i386/i586/strlen.S: Likewise.
* sysdeps/libm-i387/e_acos.S: Likewise.
* sysdeps/libm-i387/e_acosl.S: Likewise.
* sysdeps/libm-i387/e_asin.S: Likewise.
* sysdeps/libm-i387/e_asinl.S: Likewise.
* sysdeps/libm-i387/e_atan2.S: Likewise.
* sysdeps/libm-i387/e_atan2l.S: Likewise.
* sysdeps/libm-i387/e_exp.S: Likewise.
* sysdeps/libm-i387/e_expl.S: Likewise.
* sysdeps/libm-i387/e_fmod.S: Likewise.
* sysdeps/libm-i387/e_fmodl.S: Likewise.
* sysdeps/libm-i387/e_log.S: Likewise.
* sysdeps/libm-i387/e_log10.S: Likewise.
* sysdeps/libm-i387/e_log10l.S: Likewise.
* sysdeps/libm-i387/e_logl.S: Likewise.
* sysdeps/libm-i387/e_remainder.S: Likewise.
* sysdeps/libm-i387/e_remainderf.S: Likewise.
* sysdeps/libm-i387/e_remainderl.S: Likewise.
* sysdeps/libm-i387/e_scalb.S: Likewise.
* sysdeps/libm-i387/e_scalbl.S: Likewise.
* sysdeps/libm-i387/e_sqrt.S: Likewise.
* sysdeps/libm-i387/e_sqrtf.S: Likewise.
* sysdeps/libm-i387/e_sqrtl.S: Likewise.
* sysdeps/libm-i387/s_atan.S: Likewise.
* sysdeps/libm-i387/s_atanf.S: Likewise.
* sysdeps/libm-i387/s_atanl.S: Likewise.
* sysdeps/libm-i387/s_ceil.S: Likewise.
* sysdeps/libm-i387/s_ceilf.S: Likewise.
* sysdeps/libm-i387/s_ceill.S: Likewise.
* sysdeps/libm-i387/s_copysign.S: Likewise.
* sysdeps/libm-i387/s_copysignf.S: Likewise.
* sysdeps/libm-i387/s_copysignl.S: Likewise.
* sysdeps/libm-i387/s_cos.S: Likewise.
* sysdeps/libm-i387/s_cosf.S: Likewise.
* sysdeps/libm-i387/s_cosl.S: Likewise.
* sysdeps/libm-i387/s_finite.S: Likewise.
* sysdeps/libm-i387/s_finitef.S: Likewise.
* sysdeps/libm-i387/s_finitel.S: Likewise.
* sysdeps/libm-i387/s_floor.S: Likewise.
* sysdeps/libm-i387/s_floorf.S: Likewise.
* sysdeps/libm-i387/s_floorl.S: Likewise.
* sysdeps/libm-i387/s_ilogb.S: Likewise.
* sysdeps/libm-i387/s_ilogbf.S: Likewise.
* sysdeps/libm-i387/s_ilogbl.S: Likewise.
* sysdeps/libm-i387/s_log1p.S: Likewise.
* sysdeps/libm-i387/s_log1pf.S: Likewise.
* sysdeps/libm-i387/s_log1pl.S: Likewise.
* sysdeps/libm-i387/s_logb.S: Likewise.
* sysdeps/libm-i387/s_logbf.S: Likewise.
* sysdeps/libm-i387/s_logbl.S: Likewise.
* sysdeps/libm-i387/s_rint.S: Likewise.
* sysdeps/libm-i387/s_rintf.S: Likewise.
* sysdeps/libm-i387/s_rintl.S: Likewise.
* sysdeps/libm-i387/s_scalbn.S: Likewise.
* sysdeps/libm-i387/s_scalbnf.S: Likewise.
* sysdeps/libm-i387/s_scalbnl.S: Likewise.
* sysdeps/libm-i387/s_significand.S: Likewise.
* sysdeps/libm-i387/s_significandf.S: Likewise.
* sysdeps/libm-i387/s_significandl.S: Likewise.
* sysdeps/libm-i387/s_sin.S: Likewise.
* sysdeps/libm-i387/s_sinf.S: Likewise.
* sysdeps/libm-i387/s_sinl.S: Likewise.
* sysdeps/libm-i387/s_tan.S: Likewise.
* sysdeps/libm-i387/s_tanf.S: Likewise.
* sysdeps/libm-i387/s_tanl.S: Likewise.
* sysdeps/unix/sysv/linux/i386/clone.S: Add .size directive.
* sysdeps/unix/sysv/linux/i386/mmap.S. Likewise.
* sysdeps/unix/sysv/linux/i386/socket.S. Likewise.
* sysdeps/unix/sysv/linux/i386/sysdep.S. More compact .size line.
* sysdeps/i386/sysdep.h (ASM_SIZE_DIRECTIVE): New macro. Used
to provide .size directive on ELF systems.
* sysdeps/unix/sysv/linux/i386/profil-counter.h: Include
<sigcontext.h> and rename parameter type to sigcontext.
* sysdeps/unix/sysv/linux/i386/sigcontext.h New file.
* sysdeps/unix/sysv/linux/i386/syscall.S: From Linux 2.1 on
negative values might occur as positive results. Test against
-125 to decide for error or not.
* sysdeps/unix/sysv/linux/i386/sysdep.h: Likewise for system calls.
Thu Oct 3 21:07:58 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* elf/dl-open.c: Use _DYNAMIC instead of _dl_start to decide
whether this is a statically linked program. The latter is now
always defined.
Fri Oct 4 02:08:10 1996 Bang Jun-Young <bangjy@nownuri.nowcom.co.kr>
* po/ko.po: Update.
Fri Oct 4 02:07:46 1996 Michel Robitaille <robitail@IRO.UMontreal.CA>
* po/fr.po: New file.
Fri Oct 4 05:04:52 1996 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/unix/sysv/linux/i386/sigcontext.h: New file.
Add support for MD5 crypt replacement.
* Makefile (subdirs): Add crypt.
* shlib-versions: Add entry for libcrypt.
* crypt/md5-crypt.c: New file.
* crypt/md5.c: New file.
* crypt/md5.h: New file.
* sysdeps/generic/crypt-entry.c: New file.
* sysdeps/generic/crypt.h: New file.
Thu Oct 3 20:53:23 1996 Andreas Jaeger <aj@arthur.pfalz.de>
* dirent/tst-seekdir.c: Provide correct prototypes.
* io/test-utime.c: Likewise.
* malloc/mallocbug.c: Likewise.
* posix/testfnm.c: Likewise.
* stdio-common/xbug.c: Likewise.
* sysdeps/posix/cuserid.c: Likewise.
Wed Oct 2 13:33:48 1996 Richard Henderson <rth@tamu.edu>
Provide optimized string functions for Alpha processors.
* sysdeps/alpha/bzero.S: New file.
* sysdeps/alpha/memset.S: New file.
* sysdeps/alpha/stpcpy.S: New file.
* sysdeps/alpha/stpncpy.S: New file.
* sysdeps/alpha/strcat.S: New file.
* sysdeps/alpha/strchr.S: New file.
* sysdeps/alpha/strcpy.S: New file.
* sysdeps/alpha/strncat.S: New file.
* sysdeps/alpha/strncpy.S: New file.
* sysdeps/alpha/strrchr.S: New file.
* sysdeps/alpha/stxcpy.S: New file.
* sysdeps/alpha/stxncpy.S: New file.
* sysdeps/alpha/Makefile [$(sudir)==string]: Add stxcpy and
stxncpy to sysdep_routines.
Minor correction.
Wed Oct 2 13:41:48 1996 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/generic/strtok.c: Don't set stored pointer to NULL when
notheing is found. This guarantees all subsequent calls behave
the same.
* sysdeps/generic/strtok_r.c: Likewise.
Mon Sep 30 22:27:36 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/posix/tempname.c (__stdio_gen_tempname): Don't declare
`i' as const.
Mon Sep 30 22:38:29 1996 Richard Henderson <rth@tamu.edu>
* sysdeps/generic/strtok.c: When we hit EOS, don't set olds to
NULL immediately; we're going to get called one more time.
* sysdeps/generic/strtok_r.c: Likewise.
Tue Oct 1 09:12:21 1996 Ulrich Drepper <drepper@cygnus.com>
* locale/programs/ld-time.c: Always write some bytes at the end of
the file even if no `era's are specified.
* stdio-common/tmpname.c (tmpbuf): Don't define as array of
pointers.
Tue Oct 1 01:43:11 1996 Ulrich Drepper <drepper@cygnus.com>
* libio/iofclose.c: Move unlocking to right position.
Mon Sep 30 03:08:34 1996 Richard Henderson <rth@tamu.edu>
* misc/Makefile: Kill force-wrapper.
* misc/force-wrapper.c: Delete.
* elf/eval.c: Add <string.h>.
* gmon/sys/gmon_out.h: Nonsense like `char foo[sizeof(char*)]'
followed by `bcopy(&ptr, &foo, sizeof(foo))' helps portability
and binary compatibility not at all. Better to do `char *foo'
followed by `foo = ptr' as it is much cleaner.
(struct gmon_hdr): Fix version.
(struct gmon_hist_hdr): Fix low_pc, high_pc, hist_size, prof_rate.
(struct gmon_cg_arc_record): Fix from_pc, self_pc, count.
* gmon/gmon.c: De-ansidecl-ify.
(write_hist): De-bcopy-fy.
(write_call_graph): Likewise.
* gmon/mcount.c: Assume _MCOUNT_DECL does the entire declaration.
* sysdeps/alpha/machine-gmon.h: Update _MCOUNT_DECL.
* sysdeps/generic/machine-gmon.h: Likewise.
* resolv/netdb.h: Add __set_h_errno to mimic __set_errno.
* nss/getXXent_r.c: Use __set_h_errno to set h_errno in all funcs.
* nss/nss_dns/dns-network.c: Likewise.
* resolv/getunamaddr.c: Likewise. Also use __set_errno where needed.
* resolv/getnetnamadr.c: Likewise.
* resolv/res_debug.c: Likewise.
* resolv/res_mkquery.c: Likewise.
* resolv/res_query.c: Likewise.
* libio/clearerr_u.c: It's not necessary to define __ protected
function so don't do it.
* libio/feof_u.c, libio/ferror_u.c, libio/fputc_u.c,
libio/getc_u.c, libio/getchar_u.c, libio/iofflush_u.c: Likewise.
* libio/fgetc.c: Avoid a warning by casting _IO_funlockfile for
the cleanup registrar.
* libio/fputc.c, libio/freopen.c, libio/fseek.c, libio/getc.c,
libio/getchar.c, libio/iofclose.c, libio/iofflush.c,
libio/iofgetpos.c, libio/iofgets.c, libio/iofputs.c,
libio/iofread.c, libio/iofsetpos.c, libio/ioftell.c,
libio/iofwrite.c, libio/iogetdelim.c, libio/iogets.c,
libio/ioputs.c, libio/iosetbuffer.c, libio/iosetvbuf.c,
libio/ioungetc.c, libio/putc.c, libio/putchar.c, libio/rewind.c:
Likewise.
* locale/programs/ld-ctype.c: Include <alloca.h>.
* login/login_tty.c: Get login_tty prototype from <utmp.h>.
* posix/sys/types.h: Change #defines to typedefs. This is looking
forward to more comprehensive namespace cleanups for C++.
* posix/unistd.h: Likewise for ssize_t.
* pwd/getpw.c: Prototype and rename getpw -> __getpw and add a
weak alias.
* resolv/base64.c: Don't do `for (NULL; ...)' as it causes
`statement with no effect' warnings.
* resolv/inet_neta.c: Include <string.h> for strlen.
* stdio-common/getline.c: Undef ssize_t before libio redefinition.
* stdio-common/tstgetln.c: Same. De-ansidecl-ify.
* stdio-common/vfprintf.c: Same for va_list.
* stdio-common/vfscanf.c: Same.
* stdio-common/reg-printf.c: Prototype the __ function.
* stdio-common/scanf.c [USE_IN_LIBIO]: Include <libioP.h> for
_IO_vscanf declaration.
* string/tester.c: Tsk, tsk. Don't cast pointers to int,
but to unsigned long for the health of 64-bit systems.
* sunrpc/svc_udp.c: Define MAX only if we don't have it yet.
Many system's <sys/param.h> pulls this in.
* sysdeps/generic/dl-cache.c: Kill the bottom half of the
patch doubled file.
* sysdeps/generic/pty.c (forkpty): Get login_tty decl from <utmp.h>
instead of defining it locally.
* sysdeps/posix/sigvec.c: Prototype wrapper_handler and convert_mask.
* sysdeps/stub/chflags.c: Prototype chflags.
* sysdeps/stub/fchflags.c: Prototype fchflags.
* sysdeps/stub/sstk.c: Prototype sstk.
* sysdeps/unix/alpha/sysdep.S: Add strong alias from errno
variable to __errno. Update __syscall_error to store to both
the global and per-thread variables.
* sysdeps/unix/sysv/linux/init-first.c: Change include of
init-first.h from "" to <> as "" does not search the include path.
Prototype _dl_start.
Sun Sep 29 14:41:17 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/unix/Makefile ($(common-objpfx)s-proto.d): Make it a
pattern rule to get the right stem.
Sat Sep 28 01:30:06 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* Makefile ($(objpfx)version-info.h): Fix typo in previous change.
Sat Sep 28 00:44:38 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/posix/euidaccess.c (__set_errno): Fix typo.
Sat Sep 28 00:40:38 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* malloc/free.c (_free_internal): Don't call free recursively, use
the internal functions instead.
Sat Sep 28 00:23:20 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/posix/tempname.c (__stdio_gen_tempname) [USE_IN_LIBIO &&
_IO_MTSAFE_IO]: Allocate and initialize the file lock.
Fri Sep 27 23:58:17 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* catgets/gencat.c (main): Print version information on stdout,
not stderr.
* db/makedb.c: Likewise.
* locale/programs/locale.c: Likewise.
* locale/programs/localedef.c: Likewise.
Mon Sep 30 00:14:26 1996 Ulrich Drepper <drepper@cygnus.com>
Add implementation of netgroup.
* inet/Makefile (distributes): Add netgroup.h.
(routines): Add getnetgrent.c and getnetgrent_r.c.
* inet/getnetgrent.c: New file.
* inet/getnetgrent_r.c: New file.
* inet/netgroup.h: New file.
* netgroup.h: New file.
* nsswitch.h: New file.
* nss/Makefile (databases): Add getgrp.
* nss/databases.def: Add netgroup.
* nss/db-Makefile: Add rules for netgroup.
* nss/netgrp-lookup.c: New file.
* nss/nss.h: Add new status value NSS_STATUS_RETURN which will
always return without a check of the transition table.
* nss/nsswitch.h (struct service_user): Extend actions array to
five elements.
* nss/nsswitch.c (__nss_next): Allow NSS_STATUS_RETURN as legal
status value.
(nss_parse_service_list): Initialize action for NSS_STATUS_RETURN
to NSS_ACTION_RETURN.
* nss/nss_db/db-netgrp.c: New file.
* nss/nss_files/files-netgrp.c: New file.
* nss/nsswitch.conf: Add entry for netgroup.
* resolv/netdb.h: Add prototypes for netgroup functions.
* nss/nss_db/db-XXX.c: Use `enum nss_status' type when status
value is used.
Sun Sep 29 12:55:58 1996 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/unix/sysv/linux/syscalls.list: Change funciton name for
_llseek to _llseek (not llseek).
Reported by Matthias Urlichs <smurf@smurf.noris.de>.
Sun Sep 29 05:34:32 1996 Ulrich Drepper <drepper@cygnus.com>
* inet/rcmd.c: Remove definition of MIN.
Sat Sep 28 14:22:51 1996 Ulrich Drepper <drepper@cygnus.com>
* dirent/readdir_r.c: Removed. We indeed need a real implementation.
* sysdeps/unix/readdir_r.c: New file.
* sysdeps/unix/readdir.c: Remove check for correct parameter
values. Let them simply die.
* manual/filesys.texi: Document readdir_r.
* sysdeps/gnu/errlist.awk: Define _sys_errlist as `const char* const'.
Proposed by Per Abrahamsen <abraham@dina.kvl.dk>.
1996-10-06 02:05:11 +00:00
|
|
|
#endif
|