fixes for host gcc 4.6.1
[zpugcc/jano.git] / toolchain / gcc / newlib / libm / math / wf_atan2.c
blob069a7ca13ad400525a93233c8803e576d3c98f71
1 /* wf_atan2.c -- float version of w_atan2.c.
2 * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
3 */
5 /*
6 * ====================================================
7 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
9 * Developed at SunPro, a Sun Microsystems, Inc. business.
10 * Permission to use, copy, modify, and distribute this
11 * software is freely granted, provided that this notice
12 * is preserved.
13 * ====================================================
17 /*
18 * wrapper atan2f(y,x)
21 #include "fdlibm.h"
22 #include <errno.h>
24 #ifdef __STDC__
25 float atan2f(float y, float x) /* wrapper atan2f */
26 #else
27 float atan2f(y,x) /* wrapper atan2 */
28 float y,x;
29 #endif
31 #ifdef _IEEE_LIBM
32 return __ieee754_atan2f(y,x);
33 #else
34 float z;
35 struct exception exc;
36 z = __ieee754_atan2f(y,x);
37 if(_LIB_VERSION == _IEEE_||isnanf(x)||isnanf(y)) return z;
38 if(x==(float)0.0&&y==(float)0.0) {
39 /* atan2f(+-0,+-0) */
40 exc.arg1 = y;
41 exc.arg2 = x;
42 exc.err = 0;
43 exc.type = DOMAIN;
44 exc.name = "atan2f";
45 exc.retval = 0.0;
46 if(_LIB_VERSION == _POSIX_)
47 errno = EDOM;
48 else if (!matherr(&exc)) {
49 errno = EDOM;
51 if (exc.err != 0)
52 errno = exc.err;
53 return (float)exc.retval;
54 } else
55 return z;
56 #endif
59 #ifdef _DOUBLE_IS_32BITS
61 #ifdef __STDC__
62 double atan2(double y, double x)
63 #else
64 double atan2(y,x)
65 double y,x;
66 #endif
68 return (double) atan2f((float) y, (float) x);
71 #endif /* defined(_DOUBLE_IS_32BITS) */