File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change 101
101
@rule (exp (~ x)^ (~ y) => exp (~ x * ~ y))
102
102
]
103
103
104
+ TYPE_RULES = [
105
+ @rule (~ x:: _isinteger => Int (~ x))
106
+ ]
107
+
104
108
BOOLEAN_RULES = [
105
109
@rule ((true | (~ x)) => true )
106
110
@rule (((~ x) | true ) => true )
142
146
If (x -> ! ispow (x) && is_operation (^ )(x),
143
147
Chain (CANONICALIZE_POW)),
144
148
If (is_operation (^ ), Chain (POW_RULES)),
149
+ Chain (TYPE_RULES)
145
150
] |> RestartedChain
146
151
147
152
rule_tree
Original file line number Diff line number Diff line change 57
57
@test simplify (Term (zero, [x + 2 ])) == 0
58
58
end
59
59
60
+ @testset " Types" begin
61
+ @syms x
62
+
63
+ # should convert to int
64
+ @test simplify (7.0 ) === 7
65
+ @test simplify (7.0 * x) === 7 * x
66
+ end
67
+
60
68
@testset " LiteralReal" begin
61
69
@syms x1:: LiteralReal x2:: LiteralReal
62
70
s = cos (x1 * 3.2 ) - x2 * 5.8 + x2 * 1.2
You can’t perform that action at this time.
0 commit comments