[GiNaC-list] converting expressions to double

Tomasz I. Rudny rudnyt at gmail.com
Fri Mar 2 22:34:22 CET 2012


Hi.

I have found the source of the problem. Some of the numbers had values
like 1E-20 or lower. Attempt to convert them to double produced the
exception.

It was difficult to track it because the exception text appeared
randomly interwoven with the regular program output.

Thank you all for help and advice.

Kind Regards,
Tomasz.

PS. Is there any nice tutorial on GiNaC usage for polynomials? It seems
to be quite powerful in this respect...

W dniu 02.03.2012 21:11, Jens Vollinga pisze:
> Hi,
> 
> could you run your code with an added extra line like the following:
> 
> ...
>     ex = ex.subs(lst(x == _x, y == _y, z == _z, u == _u));
>     ex = ex.evalf();
>     std::cout << tree << ex << std::endl;  /* NEW NEW NEW */
>     numeric tmp = ex_to<numeric>(ex);
> ...
> 
> and report about the result? That would help pin down the problem.
> 
> Regards,
> Jens
> 
> 
> 
> On 02.03.2012 15:41, Tomasz I. Rudny wrote:
>> Hi,
>>
>> Thanks for quick reply. I am afraid this is not the case. My dbgprint()
>> of my expression looks like this (many iterations given here):
>>
>> 4.760311310558623545
>> -0.4959608476010454472
>> 0.83221034995653497086
>> 1.5383241757249394564
>> -0.31180539644482394346
>> 3.5366695187408772796
>> 0.6577950130788717955
>> 1.776523528073554051
>> 2.3553448973345405323
>> -1.4278829682706838499
>> -3.1344162711667552658
>> -8.88682924942704566
>>
>> Any suggestions?
>>
>> Kind Regards,
>> Tomasz
>>
>> W dniu 02.03.2012 12:07, Vladimir V. Kisil pisze:
>>>         Hi, Tomasz,
>>>
>>>         One of the common reasons for such problem is that your
>>>    expression still contains some variables. Make a debug print of it
>>> and
>>>    check if it is the case.
>>>
>>>    Good luck!
>>>    Vladimir
>> _______________________________________________
>> GiNaC-list mailing list
>> GiNaC-list at ginac.de
>> https://www.cebix.net/mailman/listinfo/ginac-list
> 
> _______________________________________________
> GiNaC-list mailing list
> GiNaC-list at ginac.de
> https://www.cebix.net/mailman/listinfo/ginac-list


More information about the GiNaC-list mailing list