Little fix after the last commit (mostly a git fail)
[eigenmath-fx.git] / bessely.cpp
blobb6c8fe5977a9e17ba0acdc6274a604616dd1c8ed
1 //-----------------------------------------------------------------------------
2 //
3 // Bessel Y function
4 //
5 // Input: tos-2 x (can be a symbol or expr)
6 //
7 // tos-1 n
8 //
9 // Output: Result on stack
11 //-----------------------------------------------------------------------------
13 #include "stdafx.h"
14 #include "defs.h"
16 void
17 eval_bessely(void)
19 push(cadr(p1));
20 eval();
21 push(caddr(p1));
22 eval();
23 bessely();
26 void
27 bessely(void)
29 save();
30 yybessely();
31 restore();
34 #define X p1
35 #define N p2
37 void
38 yybessely(void)
40 double d;
41 int n;
43 N = pop();
44 X = pop();
46 push(N);
47 n = pop_integer();
49 if (isdouble(X) && n != (int) 0x80000000) {
50 d = yn(n, X->u.d);
51 push_double(d);
52 return;
55 if (isnegativeterm(N)) {
56 push_integer(-1);
57 push(N);
58 power();
59 push_symbol(BESSELY);
60 push(X);
61 push(N);
62 negate();
63 list(3);
64 multiply();
65 return;
67 push_symbol(BESSELY);
68 push(X);
69 push(N);
70 list(3);
71 return;