Blame sysdeps/ieee754/dbl-64/doasin.c

Packit 6c4009
/*
Packit 6c4009
 * IBM Accurate Mathematical Library
Packit 6c4009
 * written by International Business Machines Corp.
Packit 6c4009
 * Copyright (C) 2001-2018 Free Software Foundation, Inc.
Packit 6c4009
 *
Packit 6c4009
 * This program is free software; you can redistribute it and/or modify
Packit 6c4009
 * it under the terms of the GNU Lesser General Public License as published by
Packit 6c4009
 * the Free Software Foundation; either version 2.1 of the License, or
Packit 6c4009
 * (at your option) any later version.
Packit 6c4009
 *
Packit 6c4009
 * This program is distributed in the hope that it will be useful,
Packit 6c4009
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6c4009
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 6c4009
 * GNU Lesser General Public License for more details.
Packit 6c4009
 *
Packit 6c4009
 * You should have received a copy of the GNU Lesser General Public License
Packit 6c4009
 * along with this program; if not, see <http://www.gnu.org/licenses/>.
Packit 6c4009
 */
Packit 6c4009
/**********************************************************************/
Packit 6c4009
/* MODULE_NAME: doasin.c                                              */
Packit 6c4009
/*                                                                    */
Packit 6c4009
/* FUNCTION: doasin                                                   */
Packit 6c4009
/*                                                                    */
Packit 6c4009
/* FILES NEEDED:endian.h mydefs.h dla.h doasin.h                      */
Packit 6c4009
/*              mpa.c                                                 */
Packit 6c4009
/*                                                                    */
Packit 6c4009
/* Compute arcsin(x,dx,v) of double-length number (x+dx) the result   */
Packit 6c4009
/* stored in v where v= v[0]+v[1] =arcsin(x+dx)                       */
Packit 6c4009
/**********************************************************************/
Packit 6c4009
Packit 6c4009
#include "endian.h"
Packit 6c4009
#include "mydefs.h"
Packit 6c4009
#include <dla.h>
Packit 6c4009
#include <math_private.h>
Packit 6c4009
Packit 6c4009
#ifndef SECTION
Packit 6c4009
# define SECTION
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
/********************************************************************/
Packit 6c4009
/* Compute arcsin(x,dx,v) of double-length number (x+dx) the result */
Packit 6c4009
/* stored in v where v= v[0]+v[1] =arcsin(x+dx)                     */
Packit 6c4009
/********************************************************************/
Packit 6c4009
void
Packit 6c4009
SECTION
Packit 6c4009
__doasin(double x, double dx, double v[]) {
Packit 6c4009
Packit 6c4009
#include "doasin.h"
Packit 6c4009
Packit 6c4009
  static const double
Packit 6c4009
    d5 =  0.22372159090911789889975459505194491E-01,
Packit 6c4009
    d6 =  0.17352764422456822913014975683014622E-01,
Packit 6c4009
    d7 =  0.13964843843786693521653681033981614E-01,
Packit 6c4009
    d8 =  0.11551791438485242609036067259086589E-01,
Packit 6c4009
    d9 =  0.97622386568166960207425666787248914E-02,
Packit 6c4009
    d10 = 0.83638737193775788576092749009744976E-02,
Packit 6c4009
    d11 = 0.79470250400727425881446981833568758E-02;
Packit 6c4009
Packit 6c4009
  double xx,p,pp,u,uu,r,s;
Packit 6c4009
  double tc,tcc;
Packit 6c4009
#ifndef DLA_FMS
Packit 6c4009
  double hx,tx,hy,ty,tp,tq;
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Taylor series for arcsin for Double-Length numbers         */
Packit 6c4009
  xx = x*x+2.0*x*dx;
Packit 6c4009
  p = ((((((d11*xx+d10)*xx+d9)*xx+d8)*xx+d7)*xx+d6)*xx+d5)*xx;
Packit 6c4009
  pp = 0;
Packit 6c4009
Packit 6c4009
  MUL2(x,dx,x,dx,u,uu,tp,hx,tx,hy,ty,tq,tc,tcc);
Packit 6c4009
  ADD2(p,pp,c4.x,cc4.x,p,pp,r,s);
Packit 6c4009
  MUL2(p,pp,u,uu,p,pp,tp,hx,tx,hy,ty,tq,tc,tcc);
Packit 6c4009
  ADD2(p,pp,c3.x,cc3.x,p,pp,r,s);
Packit 6c4009
  MUL2(p,pp,u,uu,p,pp,tp,hx,tx,hy,ty,tq,tc,tcc);
Packit 6c4009
  ADD2(p,pp,c2.x,cc2.x,p,pp,r,s);
Packit 6c4009
  MUL2(p,pp,u,uu,p,pp,tp,hx,tx,hy,ty,tq,tc,tcc);
Packit 6c4009
  ADD2(p,pp,c1.x,cc1.x,p,pp,r,s);
Packit 6c4009
  MUL2(p,pp,u,uu,p,pp,tp,hx,tx,hy,ty,tq,tc,tcc);
Packit 6c4009
  MUL2(p,pp,x,dx,p,pp,tp,hx,tx,hy,ty,tq,tc,tcc);
Packit 6c4009
  ADD2(p,pp,x,dx,p,pp,r,s);
Packit 6c4009
  v[0]=p;
Packit 6c4009
  v[1]=pp; /* arcsin(x+dx)=v[0]+v[1] */
Packit 6c4009
}