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

  1.  
  2. /* @(#)w_atan2.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.  
  15. /* 
  16.  * wrapper atan2(y,x)
  17.  */
  18.  
  19. #include "fdlibm.h"
  20.  
  21.  
  22. #ifdef __STDC__
  23.     double atan2(double y, double x)    /* wrapper atan2 */
  24. #else
  25.     double atan2(y,x)            /* wrapper atan2 */
  26.     double y,x;
  27. #endif
  28. {
  29. #ifdef _IEEE_LIBM
  30.     return __ieee754_atan2(y,x);
  31. #else
  32.     double z;
  33.     z = __ieee754_atan2(y,x);
  34.     if(_LIB_VERSION == _IEEE_||isnan(x)||isnan(y)) return z;
  35.     if(x==0.0&&y==0.0) {
  36.             return __kernel_standard(y,x,3); /* atan2(+-0,+-0) */
  37.     } else
  38.         return z;
  39. #endif
  40. }
  41.