[GiNaC-list] Possible bug in csrc output format.

Javier Ros jros at unavarra.es
Tue Sep 4 17:58:59 CEST 2012


I've been exporting C code from GiNaC using "csrc_double" output format
during a long time.

Now we are dealing with rather long real expressions, that involve only
+-*\ and pow. In a benchmark
and for comparison purposes we've end up comparing
the results of evaluate the same function through "dflt" (used to generate
output for MATLAB) and csrc_double
(used to generate same code for C).

Numerical discrepancies where found and traced back to to small symbolic
differences in the output obtained through both formats.

To avoid the problem and due to the symbolical simplicity of our
expressions (only +-*\ and pow) we've developed  our own -very simple-
exporting format for C.
Basically we derive our format from "dflt" and change the way in which
natural numbers and powers are written (we append a .0 to natural numbers)
and we change a^b with pow(a,b).

Right now we are obtaining a correct behaviour the export based on our new
format, coherent with "dflt" numerical results (in a particular case), and
obtaining different
 results with csrc_double (I think too with csrc alone).

So I think I'm facing a bug in csrc output format.

I wonder if anybody wants me to report further on this (I don't feel
confident as to dig into GiNaC's implementation of crsc).
If so please let me know the way in which I can report back the error (or
what I think is an error) with the required detail.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cebix.net/pipermail/ginac-list/attachments/20120904/efed6e62/attachment.html>

More information about the GiNaC-list mailing list