source: trunk/libs/newlib/src/newlib/libm/math/wf_acos.c @ 567

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

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

File size: 1.4 KB
Line 
1/* wf_acos.c -- float version of w_acos.c.
2 * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
3 */
4
5/*
6 * ====================================================
7 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
8 *
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 * ====================================================
14 */
15
16/*
17 * wrap_acosf(x)
18 */
19
20#include "fdlibm.h"
21#include <errno.h>
22
23        float acosf(float x)            /* wrapper acosf */
24{
25#ifdef _IEEE_LIBM
26        return __ieee754_acosf(x);
27#else
28        float z;
29        struct exception exc;
30        z = __ieee754_acosf(x);
31        if(_LIB_VERSION == _IEEE_ || isnan(x)) return z;
32        if(fabsf(x)>(float)1.0) {
33            /* acosf(|x|>1) */
34            exc.type = DOMAIN;
35            exc.name = "acosf";
36            exc.err = 0;
37            exc.arg1 = exc.arg2 = (double)x;
38            exc.retval = nan("");
39            if (_LIB_VERSION == _POSIX_)
40               errno = EDOM;
41            else if (!matherr(&exc)) {
42               errno = EDOM;
43            }
44            if (exc.err != 0)
45               errno = exc.err;
46            return (float)exc.retval; 
47        } else
48            return z;
49#endif
50}
51
52#ifdef _DOUBLE_IS_32BITS
53
54#ifdef __STDC__
55        double acos(double x)
56#else
57        double acos(x)
58        double x;
59#endif
60{
61        return (double) acosf((float) x);
62}
63
64#endif /* defined(_DOUBLE_IS_32BITS) */
Note: See TracBrowser for help on using the repository browser.