1 | test_float = ->
|
2 | run_test [
|
3 |
|
4 | "1.0+0",
|
5 | "1.0",
|
6 |
|
7 | "1+0.0",
|
8 | "1.0",
|
9 |
|
10 | "1+0.0-0.0",
|
11 | "1.0",
|
12 |
|
13 | "float(0)",
|
14 | "0.0",
|
15 |
|
16 | "1-float(0)",
|
17 | "1.0",
|
18 |
|
19 | "float(x)",
|
20 | "x",
|
21 |
|
22 | "float(1/2)",
|
23 | "0.5",
|
24 |
|
25 | "float(pi)",
|
26 | "3.14159",
|
27 |
|
28 | "float(exp(1))",
|
29 | "2.71828",
|
30 |
|
31 | "float(sin(2))",
|
32 | "0.909297",
|
33 |
|
34 | "float(cos(2))",
|
35 | "-0.416147",
|
36 |
|
37 | "x=[1/2,1/4]",
|
38 | "",
|
39 |
|
40 | "float(x)",
|
41 | "[0.5,0.25]",
|
42 |
|
43 | "x",
|
44 | "[1/2,1/4]",
|
45 |
|
46 | "x=quote(x)",
|
47 | "",
|
48 |
|
49 | "float((1+2*i)^(1/2))",
|
50 | "1.27202+0.786151*i",
|
51 |
|
52 | "float((1+2*(-1)^(1/2))^(1/2))",
|
53 | "1.27202+0.786151*i",
|
54 |
|
55 | "float((-1)^(-0.666667+0.0291367/pi))",
|
56 | "-0.474559-0.880224*i",
|
57 |
|
58 | "abs(float((-1)^(-0.666667+0.0291367/pi)))",
|
59 | "1.0",
|
60 |
|
61 | # using float with an array
|
62 | "a = [2,3,4]",
|
63 | "",
|
64 |
|
65 | "float(a[1])",
|
66 | "2.0",
|
67 |
|
68 | "a=quote(a)",
|
69 | "",
|
70 |
|
71 |
|
72 | ]
|
73 |
|