term -> expr; solves issue 1676
use factoring on similar terms
use rewriting to see if expr bbecomes a number

This isn't used unconditionally since the user probably doesn't want
the result rewritten in terms of exp. The result is only taken if all
the exp that were introduced are removed after factoring.