1/*
2 * IBM Accurate Mathematical Library
3 * written by International Business Machines Corp.
4 * Copyright (C) 2001 Free Software Foundation
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation; either version 2.1 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 * GNU Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 */
20/**********************************************************************/
21/* MODULE_NAME: doasin.c                                              */
22/*                                                                    */
23/* FUNCTION: doasin                                                   */
24/*                                                                    */
25/* FILES NEEDED:endian.h mydefs.h dla.h doasin.h                      */
26/*              mpa.c                                                 */
27/*                                                                    */
28/* Compute arcsin(x,dx,v) of double-length number (x+dx) the result   */
29/* stored in v where v= v[0]+v[1] =arcsin(x+dx)                       */
30/**********************************************************************/
31
32#include "endian.h"
33#include "mydefs.h"
34#include "dla.h"
35#include "math_private.h"
36
37/********************************************************************/
38/* Compute arcsin(x,dx,v) of double-length number (x+dx) the result */
39/* stored in v where v= v[0]+v[1] =arcsin(x+dx)                     */
40/********************************************************************/
41void __doasin(double x, double dx, double v[]) {
42
43#include "doasin.h"
44
45  static const double
46    d5 =  0.22372159090911789889975459505194491E-01,
47    d6 =  0.17352764422456822913014975683014622E-01,
48    d7 =  0.13964843843786693521653681033981614E-01,
49    d8 =  0.11551791438485242609036067259086589E-01,
50    d9 =  0.97622386568166960207425666787248914E-02,
51    d10 = 0.83638737193775788576092749009744976E-02,
52    d11 = 0.79470250400727425881446981833568758E-02;
53
54  double xx,p,pp,u,uu,r,s;
55  double hx,tx,hy,ty,tp,tq,tc,tcc;
56
57
58/* Taylor series for arcsin for Double-Length numbers         */
59  xx = x*x+2.0*x*dx;
60  p = ((((((d11*xx+d10)*xx+d9)*xx+d8)*xx+d7)*xx+d6)*xx+d5)*xx;
61  pp = 0;
62
63  MUL2(x,dx,x,dx,u,uu,tp,hx,tx,hy,ty,tq,tc,tcc);
64  ADD2(p,pp,c4.x,cc4.x,p,pp,r,s);
65  MUL2(p,pp,u,uu,p,pp,tp,hx,tx,hy,ty,tq,tc,tcc);
66  ADD2(p,pp,c3.x,cc3.x,p,pp,r,s);
67  MUL2(p,pp,u,uu,p,pp,tp,hx,tx,hy,ty,tq,tc,tcc);
68  ADD2(p,pp,c2.x,cc2.x,p,pp,r,s);
69  MUL2(p,pp,u,uu,p,pp,tp,hx,tx,hy,ty,tq,tc,tcc);
70  ADD2(p,pp,c1.x,cc1.x,p,pp,r,s);
71  MUL2(p,pp,u,uu,p,pp,tp,hx,tx,hy,ty,tq,tc,tcc);
72  MUL2(p,pp,x,dx,p,pp,tp,hx,tx,hy,ty,tq,tc,tcc);
73  ADD2(p,pp,x,dx,p,pp,r,s);
74  v[0]=p;
75  v[1]=pp; /* arcsin(x+dx)=v[0]+v[1] */
76}
77