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

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [newlib-1.10.0/] [newlib/] [libm/] [math/] [wf_j0.c] - Blame information for rev 1782

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1010 ivang
/* wf_j0.c -- float version of w_j0.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
 * wrapper j0f(float x), y0f(float x)
18
 */
19
 
20
#include "fdlibm.h"
21
#include <errno.h>
22
 
23
#ifdef __STDC__
24
        float j0f(float x)              /* wrapper j0f */
25
#else
26
        float j0f(x)                    /* wrapper j0f */
27
        float x;
28
#endif
29
{
30
#ifdef _IEEE_LIBM
31
        return __ieee754_j0f(x);
32
#else
33
        struct exception exc;
34
        float z = __ieee754_j0f(x);
35
        if(_LIB_VERSION == _IEEE_ || isnanf(x)) return z;
36
        if(fabsf(x)>(float)X_TLOSS) {
37
            /* j0f(|x|>X_TLOSS) */
38
            exc.type = TLOSS;
39
            exc.name = "j0f";
40
            exc.err = 0;
41
            exc.arg1 = exc.arg2 = (double)x;
42
            exc.retval = 0.0;
43
            if (_LIB_VERSION == _POSIX_)
44
               errno = ERANGE;
45
            else if (!matherr(&exc)) {
46
               errno = ERANGE;
47
            }
48
            if (exc.err != 0)
49
               errno = exc.err;
50
            return (float)exc.retval;
51
        } else
52
            return z;
53
#endif
54
}
55
 
56
#ifdef __STDC__
57
        float y0f(float x)              /* wrapper y0f */
58
#else
59
        float y0f(x)                    /* wrapper y0f */
60
        float x;
61
#endif
62
{
63
#ifdef _IEEE_LIBM
64
        return __ieee754_y0f(x);
65
#else
66
        float z;
67
        struct exception exc;
68
        z = __ieee754_y0f(x);
69
        if(_LIB_VERSION == _IEEE_ || isnanf(x) ) return z;
70
        if(x <= (float)0.0){
71
#ifndef HUGE_VAL 
72
#define HUGE_VAL inf
73
            double inf = 0.0;
74
 
75
            SET_HIGH_WORD(inf,0x7ff00000);      /* set inf to infinite */
76
#endif
77
            /* y0f(0) = -inf  or y0f(x<0) = NaN */
78
            exc.type = DOMAIN;  /* should be SING for IEEE y0f(0) */
79
            exc.name = "y0f";
80
            exc.err = 0;
81
            exc.arg1 = exc.arg2 = (double)x;
82
            if (_LIB_VERSION == _SVID_)
83
               exc.retval = -HUGE;
84
            else
85
               exc.retval = -HUGE_VAL;
86
            if (_LIB_VERSION == _POSIX_)
87
               errno = EDOM;
88
            else if (!matherr(&exc)) {
89
               errno = EDOM;
90
            }
91
            if (exc.err != 0)
92
               errno = exc.err;
93
            return (float)exc.retval;
94
        }
95
        if(x>(float)X_TLOSS) {
96
            /* y0f(x>X_TLOSS) */
97
            exc.type = TLOSS;
98
            exc.name = "y0f";
99
            exc.err = 0;
100
            exc.arg1 = exc.arg2 = (double)x;
101
            exc.retval = 0.0;
102
            if (_LIB_VERSION == _POSIX_)
103
                errno = ERANGE;
104
            else if (!matherr(&exc)) {
105
                errno = ERANGE;
106
            }
107
            if (exc.err != 0)
108
               errno = exc.err;
109
            return (float)exc.retval;
110
        } else
111
            return z;
112
#endif
113
}
114
 
115
#ifdef _DOUBLE_IS_32BITS
116
 
117
#ifdef __STDC__
118
        double j0(double x)
119
#else
120
        double j0(x)
121
        double x;
122
#endif
123
{
124
        return (double) j0f((float) x);
125
}
126
 
127
#ifdef __STDC__
128
        double y0(double x)
129
#else
130
        double y0(x)
131
        double x;
132
#endif
133
{
134
        return (double) y0f((float) x);
135
}
136
 
137
#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.