/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <sys/isa_defs.h>
#include "libm_inlines.h"
#ifdef _LITTLE_ENDIAN
#define LO(x) *(unsigned*)x
#else
#define HI(x) *(int*)x
#endif
#ifdef __RESTRICT
#define restrict _Restrict
#else
#define restrict
#endif
void
{
extern const double __vlibm_TBL_atan1[];
extern double fabs(double);
/* Power series atan(x) = x + p1*x**3 + p2*x**5 + p3*x**7
* Error = -3.08254E-18 On the interval |x| < 1/64 */
/* define dummy names for readability. Use parray to help compiler optimize loads */
static const double parray[] = {
-1.428029046844299722E-01, /* p[3] */
1.999999917247000615E-01, /* p[2] */
-3.333333333329292858E-01, /* p[1] */
1.0, /* not used for p[0], though */
-1.0, /* used to flip sign of answer */
};
if (n <= 0) return; /* if no. of elements is 0 or neg, do nothing */
do
{
f = fabs(*x); /* fetch argument */
{
{
ans = f - f; /* return NaN if x=NaN*/
}
{
dummy = 1.0e37 + f;
ans = f;
}
{
index = 2;
}
x += stridex;
y += stridey;
argcount = 0; /* initialize argcount */
if (--n <=0) break; /* we are done */
goto LOOP0; /* otherwise, examine next arg */
}
index = 0; /* points to 0,0 in table */
{ f = -1.0/f;
}
{
LO(&z) = 0; /* ...lower */
f = (f - z)/(1.0 + f*z); /* get reduced argument */
}
yaddr = y; /* address to store this answer */
x += stridex; /* point to next arg */
y += stridey; /* point to next result */
if (--n <=0)
{
f2 = 0.0;
index1 = 0;
index2 = 0;
goto UNROLL3; /* finish up with 1 good arg */
}
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
{
{
}
{
}
{
index1 = 2;
}
x += stridex;
y += stridey;
if (--n <=0)
{
f2 = 0.0;
index1 = 0;
index2 = 0;
goto UNROLL3; /* finish up with 1 good arg */
}
goto LOOP1; /* otherwise, examine next arg */
}
index1 = 0; /* points to 0,0 in table */
}
{
LO(&z) = 0; /* ...lower */
}
yaddr1 = y; /* address to store this answer */
x += stridex; /* point to next arg */
y += stridey; /* point to next result */
if (--n <=0)
{
index2 = 0;
goto UNROLL3; /* finish up with 2 good args */
}
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
{
{
}
{
}
{
index2 = 2;
}
x += stridex;
y += stridey;
if (--n <=0)
{
index2 = 0;
goto UNROLL3; /* finish up with 2 good args */
}
goto LOOP2; /* otherwise, examine next arg */
}
index2 = 0; /* points to 0,0 in table */
}
{
LO(&z) = 0; /* ...lower */
}
yaddr2 = y; /* address to store this answer */
x += stridex; /* point to next arg */
y += stridey; /* point to next result */
/* here is the 3 way unrolled section,
note, we may actually only have
1,2, or 3 'real' arguments at this point
*/
tmp = f *f ;
/* now check to see if these are 'real' or 'dummy' arguments BEFORE storing */
} while (--n > 0);
if (argcount == 2)
}
}