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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [newlib-1.17.0/] [newlib/] [libm/] [math/] [wf_j1.c] - Blame information for rev 855

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

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