fsolve: check if evalf() return value is actually a number.
authorAlexei Sheplyakov <alexei.sheplyakov@gmail.com>
Wed, 18 Aug 2010 21:07:13 +0000 (00:07 +0300)
committerJens Vollinga <jensv@nikhef.nl>
Mon, 23 Aug 2010 13:13:22 +0000 (15:13 +0200)
commit87ed87c395d6121fe468efc68ee2cd33a7e91200
treefe3cc7a958155c36ce0bc5aa8213d6783b45b709
parent37506ee54aa46203736d657c6e8a64e695303b64
fsolve: check if evalf() return value is actually a number.

Fixes the segfault triggered by

fsolve((1/(sqrt(2*Pi)))*integral(t,0,x,exp(-1/2*t^2))==0.5,x,0,100)

In general, ex_to is unsafe, and should be used only after proper checks.
evalf() may return non-numeric expression for various reasons (bad
convergence, floating point over- or underflow, out of memory, etc).
So let's add missing checks.

Thanks to Ernst Moritz Hahn for a bug report.
(cherry picked from commit 9993a7aac97abf383624fc5dae4beecb29531fbd)
ginac/inifcns.cpp