OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.17.0/] [newlib/] [libm/] [mathfp/] [s_atan.c] - Blame information for rev 158

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 148 jeremybenn
 
2
/* @(#)z_atan.c 1.0 98/08/13 */
3
 
4
/*
5
FUNCTION
6
        <<atan>>, <<atanf>>---arc tangent
7
 
8
INDEX
9
   atan
10
INDEX
11
   atanf
12
 
13
ANSI_SYNOPSIS
14
        #include <math.h>
15
        double atan(double <[x]>);
16
        float atanf(float <[x]>);
17
 
18
TRAD_SYNOPSIS
19
        #include <math.h>
20
        double atan(<[x]>);
21
        double <[x]>;
22
 
23
        float atanf(<[x]>);
24
        float <[x]>;
25
 
26
DESCRIPTION
27
 
28
<<atan>> computes the inverse tangent (arc tangent) of the input value.
29
 
30
<<atanf>> is identical to <<atan>>, save that it operates on <<floats>>.
31
 
32
RETURNS
33
@ifnottex
34
<<atan>> returns a value in radians, in the range of -pi/2 to pi/2.
35
@end ifnottex
36
@tex
37
<<atan>> returns a value in radians, in the range of $-\pi/2$ to $\pi/2$.
38
@end tex
39
 
40
PORTABILITY
41
<<atan>> is ANSI C.  <<atanf>> is an extension.
42
 
43
*/
44
 
45
/******************************************************************
46
 * Arctangent
47
 *
48
 * Input:
49
 *   x - floating point value
50
 *
51
 * Output:
52
 *   arctan of x
53
 *
54
 * Description:
55
 *   This routine returns the arctan of x.
56
 *
57
 *****************************************************************/
58
 
59
#include "fdlibm.h"
60
#include "zmath.h"
61
 
62
#ifndef _DOUBLE_IS_32BITS
63
 
64
double
65
_DEFUN (atan, (double),
66
        double x)
67
{
68
  switch (numtest (x))
69
    {
70
      case NAN:
71
        errno = EDOM;
72
        return (x);
73
      case INF:
74
        /* this should check to see if neg NaN or pos NaN... */
75
        return (__PI_OVER_TWO);
76
      case 0:
77
        return (0.0);
78
      default:
79
        return (atangent (x, 0, 0, 0));
80
    }
81
}
82
 
83
#endif /* _DOUBLE_IS_32BITS */

powered by: WebSVN 2.1.0

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