OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [newlib/] [newlib/] [libm/] [mathfp/] [s_atan2.c] - Blame information for rev 1774

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 56 joel
 
2
/* @(#)z_atan2.c 1.0 98/08/13 */
3
 
4
/*
5
FUNCTION
6
        <<atan2>>, <<atan2f>>---arc tangent of y/x
7
 
8
INDEX
9
   atan2
10
INDEX
11
   atan2f
12
 
13
ANSI_SYNOPSIS
14
        #include <math.h>
15
        double atan2(double <[y]>,double <[x]>);
16
        float atan2f(float <[y]>,float <[x]>);
17
 
18
TRAD_SYNOPSIS
19
        #include <math.h>
20
        double atan2(<[y]>,<[x]>);
21
        double <[y]>;
22
        double <[x]>;
23
 
24
        float atan2f(<[y]>,<[x]>);
25
        float <[y]>;
26
        float <[x]>;
27
 
28
DESCRIPTION
29
 
30
<<atan2>> computes the inverse tangent (arc tangent) of <[y]>/<[x]>.
31
<<atan2>> produces the correct result even for angles near
32
@ifinfo
33
pi/2 or -pi/2
34
@end ifinfo
35
@tex
36
$\pi/2$ or $-\pi/2$
37
@end tex
38
(that is, when <[x]> is near 0).
39
 
40
<<atan2f>> is identical to <<atan2>>, save that it takes and returns
41
<<float>>.
42
 
43
RETURNS
44
<<atan2>> and <<atan2f>> return a value in radians, in the range of
45
@ifinfo
46
-pi to pi.
47
@end ifinfo
48
@tex
49
$-\pi$ to $\pi$.
50
@end tex
51
 
52
If both <[x]> and <[y]> are 0.0, <<atan2>> causes a <<DOMAIN>> error.
53
 
54
You can modify error handling for these functions using <<matherr>>.
55
 
56
PORTABILITY
57
<<atan2>> is ANSI C.  <<atan2f>> is an extension.
58
 
59
 
60
*/
61
 
62
/******************************************************************
63
 * Arctangent2
64
 *
65
 * Input:
66
 *   v, u - floating point values
67
 *
68
 * Output:
69
 *   arctan2 of v / u
70
 *
71
 * Description:
72
 *   This routine returns the arctan2 of v / u.
73
 *
74
 *****************************************************************/
75
 
76
#include "fdlibm.h"
77
#include "zmath.h"
78
 
79
#ifndef _DOUBLE_IS_32BITS
80
 
81
double
82
_DEFUN (atan2, (double, double),
83
        double v _AND
84
        double u)
85
{
86
  return (atangent (0.0, v, u, 1));
87
}
88
 
89
#endif /* _DOUBLE_IS_32BITS */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.