[GiNaC-list] crash in cln when converting numeric to double

Richard B. Kreckel kreckel at ginac.de
Wed Nov 3 09:21:48 CET 2010


Hi!

On 11/02/2010 08:12 AM, Sebastian Luther wrote:
> below you'll find a small test program that crashes for me.
>
> --------------------------------------------
> #include<ginac/ginac.h>
> #include<iostream>
>
> int main(int argc, char* argv[])
> {
> 	GiNaC::parser p;
> 	GiNaC::ex e = p("941480149401/1250000000000000*2^(5/91)");
> 	GiNaC::numeric n = GiNaC::ex_to<GiNaC::numeric>(e);
> 	double x = n.to_double(); //throws the exception below
> 	return 0;
> }

Since e is a product (of a rational number and a power of two) it must 
be converted to a number using evalf() before trying to assign it to a 
simple numeric object.

> Looks like the real problem lays in cln, but I'm not sure how to reproduce it there.

It has nothing to do with CLN.

Best wishes
    -richy.
-- 
Richard B. Kreckel
<http://www.ginac.de/~kreckel/>


More information about the GiNaC-list mailing list