]> www.ginac.de Git - ginac.git/commit
Make sure add::eval() collects all numeric terms.
authorRichard Kreckel <kreckel@ginac.de>
Wed, 22 Sep 2010 22:40:38 +0000 (00:40 +0200)
committerRichard Kreckel <kreckel@ginac.de>
Wed, 22 Sep 2010 22:56:47 +0000 (00:56 +0200)
commit89d5356b4aa33cb4481575f9453f36c3404b015b
tree173c5c5f3a8a264315cff320dcef44cb5ad3edf5
parent90ad10b58d02365a407b2d84d8b93e50030feaa5
Make sure add::eval() collects all numeric terms.

Apparently, add::eval() assumed that none of the elements of its epvector
has a numeric rest. However, nothing guarantees that -- in particular
evalchildren() doesn't (and actually cannot) do so. Since there are many
places where a new add is constructed directly from an epvector, enforcing
this doesn't make sense either. One example where it did fail was found by
Burgin Erocal: real_part(1+2*(sqrt(2)+1)*(sqrt(2)-1)) returned 1+2*1, not 3.

Thanks to Burcin Erocal for reporting this bug.
(cherry picked from commit e08cda1854bdb82f6706ec269233577690ae00e4)
check/exam_paranoia.cpp
ginac/add.cpp