1 | /* |
2 | * IBM Accurate Mathematical Library |
3 | * written by International Business Machines Corp. |
4 | * Copyright (C) 2001-2021 Free Software Foundation, Inc. |
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, see <https://www.gnu.org/licenses/>. |
18 | */ |
19 | /**********************************************************************/ |
20 | /* MODULE_NAME: doasin.c */ |
21 | /* */ |
22 | /* FUNCTION: doasin */ |
23 | /* */ |
24 | /* FILES NEEDED:endian.h mydefs.h dla.h doasin.h */ |
25 | /* mpa.c */ |
26 | /* */ |
27 | /* Compute arcsin(x,dx,v) of double-length number (x+dx) the result */ |
28 | /* stored in v where v= v[0]+v[1] =arcsin(x+dx) */ |
29 | /**********************************************************************/ |
30 | |
31 | #include "endian.h" |
32 | #include "mydefs.h" |
33 | #include <dla.h> |
34 | #include <math_private.h> |
35 | |
36 | #ifndef SECTION |
37 | # define SECTION |
38 | #endif |
39 | |
40 | /********************************************************************/ |
41 | /* Compute arcsin(x,dx,v) of double-length number (x+dx) the result */ |
42 | /* stored in v where v= v[0]+v[1] =arcsin(x+dx) */ |
43 | /********************************************************************/ |
44 | void |
45 | SECTION |
46 | __doasin(double x, double dx, double v[]) { |
47 | |
48 | #include "doasin.h" |
49 | |
50 | static const double |
51 | d5 = 0.22372159090911789889975459505194491E-01, |
52 | d6 = 0.17352764422456822913014975683014622E-01, |
53 | d7 = 0.13964843843786693521653681033981614E-01, |
54 | d8 = 0.11551791438485242609036067259086589E-01, |
55 | d9 = 0.97622386568166960207425666787248914E-02, |
56 | d10 = 0.83638737193775788576092749009744976E-02, |
57 | d11 = 0.79470250400727425881446981833568758E-02; |
58 | |
59 | double xx,p,pp,u,uu,r,s; |
60 | double tc,tcc; |
61 | |
62 | |
63 | /* Taylor series for arcsin for Double-Length numbers */ |
64 | xx = x*x+2.0*x*dx; |
65 | p = ((((((d11*xx+d10)*xx+d9)*xx+d8)*xx+d7)*xx+d6)*xx+d5)*xx; |
66 | pp = 0; |
67 | |
68 | MUL2(x,dx,x,dx,u,uu,tc,tcc); |
69 | ADD2(p,pp,c4.x,cc4.x,p,pp,r,s); |
70 | MUL2(p,pp,u,uu,p,pp,tc,tcc); |
71 | ADD2(p,pp,c3.x,cc3.x,p,pp,r,s); |
72 | MUL2(p,pp,u,uu,p,pp,tc,tcc); |
73 | ADD2(p,pp,c2.x,cc2.x,p,pp,r,s); |
74 | MUL2(p,pp,u,uu,p,pp,tc,tcc); |
75 | ADD2(p,pp,c1.x,cc1.x,p,pp,r,s); |
76 | MUL2(p,pp,u,uu,p,pp,tc,tcc); |
77 | MUL2(p,pp,x,dx,p,pp,tc,tcc); |
78 | ADD2(p,pp,x,dx,p,pp,r,s); |
79 | v[0]=p; |
80 | v[1]=pp; /* arcsin(x+dx)=v[0]+v[1] */ |
81 | } |
82 | |