]> git.proxmox.com Git - mirror_edk2.git/blobdiff - StdLib/LibC/Math/e_atan2.c
edk2: Remove AppPkg, StdLib, StdLibPrivateInternalFiles
[mirror_edk2.git] / StdLib / LibC / Math / e_atan2.c
diff --git a/StdLib/LibC/Math/e_atan2.c b/StdLib/LibC/Math/e_atan2.c
deleted file mode 100644 (file)
index 309447c..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-/* @(#)e_atan2.c 5.1 93/09/24 */\r
-/*\r
- * ====================================================\r
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\r
- *\r
- * Developed at SunPro, a Sun Microsystems, Inc. business.\r
- * Permission to use, copy, modify, and distribute this\r
- * software is freely granted, provided that this notice\r
- * is preserved.\r
- * ====================================================\r
- */\r
-#include  <LibConfig.h>\r
-#include  <sys/EfiCdefs.h>\r
-#if defined(LIBM_SCCS) && !defined(lint)\r
-__RCSID("$NetBSD: e_atan2.c,v 1.12 2002/05/26 22:01:48 wiz Exp $");\r
-#endif\r
-\r
-#if defined(_MSC_VER)           /* Handle Microsoft VC++ compiler specifics. */\r
-  // unary minus operator applied to unsigned type, result still unsigned\r
-  #pragma warning ( disable : 4146 )\r
-#endif\r
-\r
-/* __ieee754_atan2(y,x)\r
- * Method :\r
- *  1. Reduce y to positive by atan2(y,x)=-atan2(-y,x).\r
- *  2. Reduce x to positive by (if x and y are unexceptional):\r
- *    ARG (x+iy) = arctan(y/x)       ... if x > 0,\r
- *    ARG (x+iy) = pi - arctan[y/(-x)]   ... if x < 0,\r
- *\r
- * Special cases:\r
- *\r
- *  ATAN2((anything), NaN ) is NaN;\r
- *  ATAN2(NAN , (anything) ) is NaN;\r
- *  ATAN2(+-0, +(anything but NaN)) is +-0  ;\r
- *  ATAN2(+-0, -(anything but NaN)) is +-pi ;\r
- *  ATAN2(+-(anything but 0 and NaN), 0) is +-pi/2;\r
- *  ATAN2(+-(anything but INF and NaN), +INF) is +-0 ;\r
- *  ATAN2(+-(anything but INF and NaN), -INF) is +-pi;\r
- *  ATAN2(+-INF,+INF ) is +-pi/4 ;\r
- *  ATAN2(+-INF,-INF ) is +-3pi/4;\r
- *  ATAN2(+-INF, (anything but,0,NaN, and INF)) is +-pi/2;\r
- *\r
- * Constants:\r
- * The hexadecimal values are the intended ones for the following\r
- * constants. The decimal values may be used, provided that the\r
- * compiler will convert from decimal to binary accurately enough\r
- * to produce the hexadecimal values shown.\r
- */\r
-\r
-#include "math.h"\r
-#include "math_private.h"\r
-\r
-static const double\r
-tiny  = 1.0e-300,\r
-zero  = 0.0,\r
-pi_o_4  = 7.8539816339744827900E-01, /* 0x3FE921FB, 0x54442D18 */\r
-pi_o_2  = 1.5707963267948965580E+00, /* 0x3FF921FB, 0x54442D18 */\r
-pi      = 3.1415926535897931160E+00, /* 0x400921FB, 0x54442D18 */\r
-pi_lo   = 1.2246467991473531772E-16; /* 0x3CA1A626, 0x33145C07 */\r
-\r
-double\r
-__ieee754_atan2(double y, double x)\r
-{\r
-  double z;\r
-  int32_t k,m,hx,hy,ix,iy;\r
-  u_int32_t lx,ly;\r
-\r
-  EXTRACT_WORDS(hx,lx,x);\r
-  ix = hx&0x7fffffff;\r
-  EXTRACT_WORDS(hy,ly,y);\r
-  iy = hy&0x7fffffff;\r
-  if(((ix|((lx|-lx)>>31))>0x7ff00000)||\r
-     ((iy|((ly|-ly)>>31))>0x7ff00000))  /* x or y is NaN */\r
-     return x+y;\r
-  if(((hx-0x3ff00000)|lx)==0) return atan(y);   /* x=1.0 */\r
-  m = ((hy>>31)&1)|((hx>>30)&2);  /* 2*sign(x)+sign(y) */\r
-\r
-    /* when y = 0 */\r
-  if((iy|ly)==0) {\r
-      switch(m) {\r
-    case 0:\r
-    case 1: return y;   /* atan(+-0,+anything)=+-0 */\r
-    case 2: return  pi+tiny;/* atan(+0,-anything) = pi */\r
-    case 3: return -pi-tiny;/* atan(-0,-anything) =-pi */\r
-      }\r
-  }\r
-    /* when x = 0 */\r
-  if((ix|lx)==0) return (hy<0)?  -pi_o_2-tiny: pi_o_2+tiny;\r
-\r
-    /* when x is INF */\r
-  if(ix==0x7ff00000) {\r
-      if(iy==0x7ff00000) {\r
-    switch(m) {\r
-        case 0: return  pi_o_4+tiny;/* atan(+INF,+INF) */\r
-        case 1: return -pi_o_4-tiny;/* atan(-INF,+INF) */\r
-        case 2: return  3.0*pi_o_4+tiny;/*atan(+INF,-INF)*/\r
-        case 3: return -3.0*pi_o_4-tiny;/*atan(-INF,-INF)*/\r
-    }\r
-      } else {\r
-    switch(m) {\r
-        case 0: return  zero  ; /* atan(+...,+INF) */\r
-        case 1: return -zero  ; /* atan(-...,+INF) */\r
-        case 2: return  pi+tiny  ;  /* atan(+...,-INF) */\r
-        case 3: return -pi-tiny  ;  /* atan(-...,-INF) */\r
-    }\r
-      }\r
-  }\r
-    /* when y is INF */\r
-  if(iy==0x7ff00000) return (hy<0)? -pi_o_2-tiny: pi_o_2+tiny;\r
-\r
-    /* compute y/x */\r
-  k = (iy-ix)>>20;\r
-  if(k > 60) z=pi_o_2+0.5*pi_lo;  /* |y/x| >  2**60 */\r
-  else if(hx<0&&k<-60) z=0.0;   /* |y|/x < -2**60 */\r
-  else z=atan(fabs(y/x));   /* safe to do y/x */\r
-  switch (m) {\r
-      case 0: return       z  ; /* atan(+,+) */\r
-      case 1: {\r
-              u_int32_t zh;\r
-          GET_HIGH_WORD(zh,z);\r
-          SET_HIGH_WORD(z,zh ^ 0x80000000);\r
-        }\r
-        return       z  ; /* atan(-,+) */\r
-      case 2: return  pi-(z-pi_lo);/* atan(+,-) */\r
-      default: /* case 3 */\r
-            return  (z-pi_lo)-pi;/* atan(-,-) */\r
-  }\r
-}\r