UNPKG

1.4 kBtext/coffeescriptView Raw
1test_tan = ->
2 run_test [
3 "tan(x)",
4 "tan(x)",
5
6 "tan(-x)",
7 "-tan(x)",
8
9 "tan(b-a)",
10 "-tan(a-b)",
11
12 # check against the floating point math library
13
14 "f(a,x)=1+tan(float(a/360*2*pi))-float(x)+tan(a/360*2*pi)-x",
15 "",
16
17 "f(0,0)", # 0
18 "1.0",
19
20 "f(180,0)", # 180
21 "1.0",
22
23 "f(360,0)", # 360
24 "1.0",
25
26 "f(-180,0)", # -180
27 "1.0",
28
29 "f(-360,0)", # -360
30 "1.0",
31
32 "f(45,1)", # 45
33 "1.0",
34
35 "f(135,-1)", # 135
36 "1.0",
37
38 "f(225,1)", # 225
39 "1.0",
40
41 "f(315,-1)", # 315
42 "1.0",
43
44 "f(-45,-1)", # -45
45 "1.0",
46
47 "f(-135,1)", # -135
48 "1.0",
49
50 "f(-225,-1)", # -225
51 "1.0",
52
53 "f(-315,1)", # -315
54 "1.0",
55
56 "f(30,sqrt(3)/3)", # 30
57 "1.0",
58
59 "f(150,-sqrt(3)/3)", # 150
60 "1.0",
61
62 "f(210,sqrt(3)/3)", # 210
63 "1.0",
64
65 "f(330,-sqrt(3)/3)", # 330
66 "1.0",
67
68 "f(-30,-sqrt(3)/3)", # -30
69 "1.0",
70
71 "f(-150,sqrt(3)/3)", # -150
72 "1.0",
73
74 "f(-210,-sqrt(3)/3)", # -210
75 "1.0",
76
77 "f(-330,sqrt(3)/3)", # -330
78 "1.0",
79
80 "f(60,sqrt(3))", # 60
81 "1.0",
82
83 "f(120,-sqrt(3))", # 120
84 "1.0",
85
86 "f(240,sqrt(3))", # 240
87 "1.0",
88
89 "f(300,-sqrt(3))", # 300
90 "1.0",
91
92 "f(-60,-sqrt(3))", # -60
93 "1.0",
94
95 "f(-120,sqrt(3))", # -120
96 "1.0",
97
98 "f(-240,-sqrt(3))", # -240
99 "1.0",
100
101 "f(-300,sqrt(3))", # -300
102 "1.0",
103
104 "f=quote(f)",
105 "",
106
107 "tan(arctan(x))",
108 "x",
109
110 # check the default case
111
112 "tan(1/12*pi)",
113 "tan(1/12*pi)",
114 ]