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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [newlib/] [newlib/] [libm/] [math/] [wf_acos.c] - Blame information for rev 39

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

Line No. Rev Author Line
1 39 lampret
/* 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
#ifdef _HAVE_STDC
24
        float acosf(float x)            /* wrapper acosf */
25
#else
26
        float acosf(x)                  /* wrapper acosf */
27
        float x;
28
#endif
29
{
30
#ifdef _IEEE_LIBM
31
        return __ieee754_acosf(x);
32
#else
33
        float z;
34
        struct exception exc;
35
        z = __ieee754_acosf(x);
36
        if(_LIB_VERSION == _IEEE_ || isnanf(x)) return z;
37
        if(fabsf(x)>(float)1.0) {
38
            /* acosf(|x|>1) */
39
            exc.type = DOMAIN;
40
            exc.name = "acosf";
41
            exc.retval = 0.0;
42
            if (_LIB_VERSION == _POSIX_)
43
               errno = EDOM;
44
            else if (!matherr(&exc)) {
45
               errno = EDOM;
46
            }
47
            if (exc.err != 0)
48
               errno = exc.err;
49
            return (float)exc.retval;
50
        } else
51
            return z;
52
#endif
53
}
54
 
55
#ifdef _DOUBLE_IS_32BITS
56
 
57
#ifdef __STDC__
58
        double acos(double x)
59
#else
60
        double acos(x)
61
        double x;
62
#endif
63
{
64
        return (double) acosf((float) x);
65
}
66
 
67
#endif /* defined(_DOUBLE_IS_32BITS) */

powered by: WebSVN 2.1.0

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