]> 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:40:38 +0000 (00:40 +0200)
commite08cda1854bdb82f6706ec269233577690ae00e4
treeb48fe414b18f3a1bd86cb58077e0c0a94c8be9c1
parent9506030d2059ef868d5da8dcbe714c9c5b50ff50
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.
check/exam_paranoia.cpp
ginac/add.cpp