/* RCS $Id: q_acth.c,v 1.2 1997/07/15 14:57:04 ae13 Exp $ */
/*
$Log: q_acth.c,v $
 * Revision 1.2  1997/07/15  14:57:04  ae13
 * *** empty log message ***
 *
 * Revision 1.1  1997/05/16  13:29:06  ae13
 * Initial revision
 *
 */
/****************************************************************/
/*                                                              */
/*      Entries         : a_real q_acth(a_real x)               */
/*                        a_real x  ;                           */
/*                                                              */
/*      Arguments       : x = real argument of acth(x)          */
/*                                                              */
/*      Description     : Fast real area cotangens function     */
/*                        for double IEEE Floating-Point        */
/*                        Arithmetic                            */
/*                                                              */
/*      Date            : 1997-03-13                            */
/*                                                              */
/*      Author          : W. Hofschuster                        */
/*                                                              */
/****************************************************************/

#ifndef ALL_IN_ONE
#ifdef AIX
#include "/u/p88c/runtime/o_defs.h"
#else
#include "o_defs.h"
#endif
#define local
#endif


#include "q_defs.h"
#include "q_fcth.h"

#ifdef LINT_ARGS
local double q_acth(double x)
#else
local double q_acth(x)

double x;
#endif
{
  double absx, res;
 
#ifdef PXSCTRAP  
  E_SPUSH("q_acth");
#endif
  if NANTEST(x)                                       /* Test: x=NaN */
    res=q_abortnan(INV_ARG,&x,25);
  else {
    if (x<0) absx=-x; else absx=x;  
    if (absx<=1.0) 
      res=q_abortr1(INV_ARG,&x,25);
    res=0.5*q_l1p1(2.0/(absx-1.0));
    if (x!=absx) res=-res;
  }
#ifdef PXSCTRAP
  E_SPOPP("q_acth");
#endif
  return(res);
}

