Commit 68053144 authored by Hemery Mathieu's avatar Hemery Mathieu
Browse files

Avoid infty loop on distribute

parent e740be66
......@@ -609,6 +609,7 @@ rewrite_distribute(A^1, A).
rewrite_distribute(A^N, A*A^Nm) :-
integer(N),
N > 1,
Nm is N-1.
......
......@@ -2,9 +2,13 @@
:- begin_tests(arithmetic_rules, [setup((clear_model, reset_options))]).
test('distribute', [true(Out == a * a + a * b + c)]) :-
test('distribute1', [true(Out == a * a + a * b + c)]) :-
distribute(a * (a + b) + c, Out).
test('distribute2', []) :-
distribute((a+b)^2, a*a+a*b+(b*a+b*b)),
distribute((a+b)^ -2, (a+b)^ -2).
test('is_null', []) :-
is_null(a*0*1/2),
\+(is_null(a*b/0)).
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment