Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
4349 Serge 1
 
2
/*
3
 * ====================================================
4
 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
5
 *
6
 * Developed at SunPro, a Sun Microsystems, Inc. business.
7
 * Permission to use, copy, modify, and distribute this
8
 * software is freely granted, provided that this notice
9
 * is preserved.
10
 * ====================================================
11
 */
12
13
 
14
 * wrapper of j1,y1
15
 */
16
17
 
18
#include 
19
20
 
21
22
 
23
	double j1(double x)		/* wrapper j1 */
24
#else
25
	double j1(x)			/* wrapper j1 */
26
	double x;
27
#endif
28
{
29
#ifdef _IEEE_LIBM
30
	return __ieee754_j1(x);
31
#else
32
	double z;
33
	struct exception exc;
34
	z = __ieee754_j1(x);
35
	if(_LIB_VERSION == _IEEE_ || isnan(x) ) return z;
36
	if(fabs(x)>X_TLOSS) {
37
	    /* j1(|x|>X_TLOSS) */
38
            exc.type = TLOSS;
39
            exc.name = "j1";
40
	    exc.err = 0;
41
	    exc.arg1 = exc.arg2 = 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 exc.retval;
51
	} else
52
	    return z;
53
#endif
54
}
55
56
 
57
	double y1(double x)		/* wrapper y1 */
58
#else
59
	double y1(x)			/* wrapper y1 */
60
	double x;
61
#endif
62
{
63
#ifdef _IEEE_LIBM
64
	return __ieee754_y1(x);
65
#else
66
	double z;
67
	struct exception exc;
68
	z = __ieee754_y1(x);
69
	if(_LIB_VERSION == _IEEE_ || isnan(x) ) return z;
70
        if(x <= 0.0){
71
#ifndef HUGE_VAL
72
#define HUGE_VAL inf
73
	    double inf = 0.0;
74
75
 
76
#endif
77
	    /* y1(0) = -inf  or y1(x<0) = NaN */
78
	    exc.type = DOMAIN;	/* should be SING for IEEE */
79
	    exc.name = "y1";
80
	    exc.err = 0;
81
	    exc.arg1 = exc.arg2 = 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 exc.retval;
94
        }
95
	if(x>X_TLOSS) {
96
	    /* y1(x>X_TLOSS) */
97
            exc.type = TLOSS;
98
            exc.name = "y1";
99
	    exc.err = 0;
100
	    exc.arg1 = exc.arg2 = 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 exc.retval;
110
	} else
111
	    return z;
112
#endif
113
}
114
115
 
116