File tree Expand file tree Collapse file tree 3 files changed +14
-1
lines changed Expand file tree Collapse file tree 3 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ function simplify(x;
3939 end
4040
4141 x = PassThrough (f)(x)
42- simplify_fractions && has_operation (x, / ) ?
42+ x = simplify_fractions && has_operation (x, / ) ?
4343 SymbolicUtils. simplify_fractions (x) : x
4444end
4545
Original file line number Diff line number Diff line change 101101 @rule (exp (~ x)^ (~ y) => exp (~ x * ~ y))
102102 ]
103103
104+ TYPE_RULES = [
105+ @rule (~ x:: _isinteger => Int (~ x))
106+ ]
107+
104108 BOOLEAN_RULES = [
105109 @rule ((true | (~ x)) => true )
106110 @rule (((~ x) | true ) => true )
142146 If (x -> ! ispow (x) && is_operation (^ )(x),
143147 Chain (CANONICALIZE_POW)),
144148 If (is_operation (^ ), Chain (POW_RULES)),
149+ Chain (TYPE_RULES)
145150 ] |> RestartedChain
146151
147152 rule_tree
Original file line number Diff line number Diff line change 5757 @test simplify (Term (zero, [x + 2 ])) == 0
5858end
5959
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+
6068@testset " LiteralReal" begin
6169 @syms x1:: LiteralReal x2:: LiteralReal
6270 s = cos (x1 * 3.2 ) - x2 * 5.8 + x2 * 1.2
You can’t perform that action at this time.
0 commit comments