home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: Science / Science.zip / gmt_os2.zip / src / math / w_atanh.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-03-16  |  944 b   |  43 lines

  1.  
  2. /* @(#)w_atanh.c 1.3 95/01/18 */
  3. /*
  4.  * ====================================================
  5.  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
  6.  *
  7.  * Developed at SunSoft, a Sun Microsystems, Inc. business.
  8.  * Permission to use, copy, modify, and distribute this
  9.  * software is freely granted, provided that this notice 
  10.  * is preserved.
  11.  * ====================================================
  12.  */
  13. /* 
  14.  * wrapper atanh(x)
  15.  */
  16.  
  17. #include "fdlibm.h"
  18.  
  19.  
  20. #ifdef __STDC__
  21.     double atanh(double x)        /* wrapper atanh */
  22. #else
  23.     double atanh(x)            /* wrapper atanh */
  24.     double x;
  25. #endif
  26. {
  27. #ifdef _IEEE_LIBM
  28.     return __ieee754_atanh(x);
  29. #else
  30.     double z,y;
  31.     z = __ieee754_atanh(x);
  32.     if(_LIB_VERSION == _IEEE_ || isnan(x)) return z;
  33.     y = fabs(x);
  34.     if(y>=1.0) {
  35.         if(y>1.0)
  36.             return __kernel_standard(x,x,30); /* atanh(|x|>1) */
  37.         else 
  38.             return __kernel_standard(x,x,31); /* atanh(|x|==1) */
  39.     } else
  40.         return z;
  41. #endif
  42. }
  43.