source: trunk/libs/newlib/src/newlib/libm/mathfp/s_atan.c @ 471

Last change on this file since 471 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

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