UNPKG

926 Btext/coffeescriptView Raw
1test_multiply = ->
2 if DEBUG then console.log "test_multiply ----------------------------"
3 run_test [
4
5 "0*a",
6 "0",
7
8 "a*0",
9 "0",
10
11 "1*a",
12 "a",
13
14 "a*1",
15 "a",
16
17 "0.0*a",
18 "0.0",
19
20 "a*0.0",
21 "0.0",
22
23 "1.0*a",
24 "1.0*a",
25
26 "a*1.0",
27 "1.0*a",
28
29 "a*a",
30 "a^2",
31
32 "a^2*a",
33 "a^3",
34
35 "a*a^2",
36 "a^3",
37
38 "a^2*a^2",
39 "a^4",
40
41 "2^a*2^(3-a)", # symbolic exponents cancel
42 "8",
43
44 "sqrt(2)/2",
45 # leave the roots nice and
46 # clean in numerator, avoid these
47 # forms
48 #"2^(-1/2)",
49 "1/2*2^(1/2)",
50
51 "2/sqrt(2)",
52 "2^(1/2)",
53
54 "-sqrt(2)/2",
55 # avoid having roots in denominator
56 #"-1/(2^(1/2))",
57 "-1/2*2^(1/2)",
58
59 "2^(1/2-a)*2^a/10",
60 # avoid roots in denominator
61 #"1/(5*2^(1/2))",
62 "1/10*2^(1/2)",
63
64 "i/4",
65 "1/4*i",
66
67 "1/(4 i)",
68 "-1/4*i",
69
70 # ensure 1.0 is not discarded
71
72 "1.0 pi 1/2",
73 "1.5708",
74
75 "1.0 1/2 pi",
76 "1.5708",
77 ]