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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [newlib/] [newlib/] [libm/] [math/] [wf_j1.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_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.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 exc.retval;
51
        } else
52
            return z;
53
#endif
54
}
55
 
56
#ifdef __STDC__
57
        float y1f(float x)              /* wrapper y1f */
58
#else
59
        float y1f(x)                    /* wrapper y1f */
60
        float x;
61
#endif
62
{
63
#ifdef _IEEE_LIBM
64
        return __ieee754_y1f(x);
65
#else
66
        float z;
67
        struct exception exc;
68
        z = __ieee754_y1f(x);
69
        if(_LIB_VERSION == _IEEE_ || isnanf(x) ) return z;
70
        if(x <= (float)0.0){
71
            /* y1f(0) = -inf or y1f(x<0) = NaN */
72
#ifndef HUGE_VAL 
73
#define HUGE_VAL inf
74
            double inf = 0.0;
75
 
76
            SET_HIGH_WORD(inf,0x7ff00000);      /* set inf to infinite */
77
#endif
78
            exc.type = DOMAIN;  /* should be SING for IEEE */
79
            exc.name = "y1f";
80
            if (_LIB_VERSION == _SVID_)
81
               exc.retval = -HUGE;
82
            else
83
               exc.retval = -HUGE_VAL;
84
            if (_LIB_VERSION == _POSIX_)
85
               errno = EDOM;
86
            else if (!matherr(&exc)) {
87
               errno = EDOM;
88
            }
89
            if (exc.err != 0)
90
               errno = exc.err;
91
            return (float)exc.retval;
92
        }
93
        if(x>(float)X_TLOSS) {
94
            /* y1f(x>X_TLOSS) */
95
            exc.type = TLOSS;
96
            exc.name = "y1f";
97
            exc.retval = 0.0;
98
            if (_LIB_VERSION == _POSIX_)
99
                errno = ERANGE;
100
            else if (!matherr(&exc)) {
101
                errno = ERANGE;
102
            }
103
            if (exc.err != 0)
104
               errno = exc.err;
105
            return (float)exc.retval;
106
        } else
107
            return z;
108
#endif
109
}
110
 
111
#ifdef _DOUBLE_IS_32BITS
112
 
113
#ifdef __STDC__
114
        double j1(double x)
115
#else
116
        double j1(x)
117
        double x;
118
#endif
119
{
120
        return (double) j1f((float) x);
121
}
122
 
123
#ifdef __STDC__
124
        double y1(double x)
125
#else
126
        double y1(x)
127
        double x;
128
#endif
129
{
130
        return (double) y1f((float) x);
131
}
132
 
133
#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.