]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/bc/tests/bc/scripts/bessel.bc
usr.bin/gh-bc, contrib/bc: update to version 5.0.0
[FreeBSD/FreeBSD.git] / contrib / bc / tests / bc / scripts / bessel.bc
1 #! /usr/bin/bc -q
2
3 t[0] = 0
4 t[1] = 0.5
5 t[2] = 1
6 t[3] = 1.5
7 t[4] = 1.74
8 t[5] = 2
9 t[6] = 3.2345
10 t[7] = 100
11 t[8] = -0.5
12 t[9] = -1
13 t[10] = -1.5
14 t[11] = -1.74
15 t[12] = -2
16 t[13] = -3.2345
17 t[14] = -100
18 t[15] = 0.0000000000000000
19
20 l = 16
21
22 a[0] = t[0]
23
24 for (i = 1; i < l; ++i) {
25         a[i * 2 - 1] = t[i]
26         a[i * 2] = -t[i]
27 }
28
29 l *= 2
30 l -= 1
31
32 for (i = 0; i < l; ++i) {
33         for (j = 0; j < l; ++j) {
34                 print "j(", a[i]
35                 if (a[i] == 0 && scale(a[i]) > 0) print ".0000000000000000"
36                 print ", ", a[j]
37                 if (a[j] == 0 && scale(a[j]) > 0) print ".0000000000000000"
38                 print ")\n"
39         }
40 }
41
42 # These are specific tests that bc could not pass at one time.
43 print "j(3, 0.75)\n"
44 print "scale = 0; j(40, 0.75)\n"
45
46 print "halt\n"
47
48 halt