/**************************************************************************/
/*                                                                        */
/*                                 Sources                                */
/*                                from  the                               */
/*                           XSC SOFTWARE PACKAGE                         */
/*                                                                        */
/*                Copyright (c) 1997 University of Karlsruhe              */
/*                     Institute for Appl. Mathematics                    */
/*                                                                        */
/* This program is free software for non-commercial use. For details, see */
/* the file LICENSE.XSC, distributed with this software package.          */
/*                                                                        */
/* This program is distributed WITHOUT ANY WARRANTY. For details, see the */
/* file LICENSE.XSC, distributed with this software package.              */
/*                                                                        */
/**************************************************************************/

/* RCS $Id: t_acvt.c,v 1.2 1997/09/25 18:05:51 ae59 Exp $ */
/*
$Log: t_acvt.c,v $
 * Revision 1.2  1997/09/25  18:05:51  ae59
 * Copyright-message
 *
 * Revision 1.1  1994/01/27  13:24:58  ae59
 * Put under RCS control
 *
 */
/*      Date    : 1991-09-06                                    */
/*      1991-09-06 : reduce maximum line length                 */

#ifdef AIX
#include "/u/p88c/runtime/tbyte/t_defs.h"
#else
#include "t_defs.h"
#endif

/*--------------------------------------------------------------*
 | acosviatan                                                   |
 *--------------------------------------------------------------*/
#ifdef ANSI_C
#ifdef LINT_ARGS
int acosviatan(const ExtReal *arg, ExtReal *res)
#else
int acosviatan(arg, res)
const ExtReal  *arg;
      ExtReal  *res;
#endif /* LINT_ARGS */
#else  /* NOT ANSI_C */
#ifdef LINT_ARGS
int acosviatan(ExtReal *arg, ExtReal *res)
#else
int acosviatan(arg, res)
ExtReal  *arg;
ExtReal  *res;
#endif /* LINT_ARGS */
#endif /* ANSI_C */
{
   ExtReal rp1;
   ExtReal rm1;
   ExtReal r;
   ExtReal rsqrt;
   ExtReal rdiv;
   int   ret;

   ret =  subee(&One, arg, &rm1);
   ret += addee(&One, arg, &rp1);
   ret += mulee(&rp1, &rm1, &r);
   ret += sqrtee(&r, &rsqrt);

   if(ret += divee(&rsqrt, arg, &rdiv)) return ret;

   ret = _s_atan(&rdiv, res);

   return ret;
} /* acosviatan() */
