[GiNaC-list] Problem: Floating point overflow

Alberto Orlandi Alberto.Orlandi at roma1.infn.it
Thu Mar 29 11:50:25 CEST 2007


Hi,
I have a question about error handling. I have a problem with the "Floating point overflow".
May be is better if I give an example:

#include<iostream>
#include<fstream>
#include<string>
#include<ginac/ginac.h>

int main(void)
{
  try{
    GiNaC::realsymbol x("x");
    GiNaC::ex pp("sin(sin(sin(sin(log(-0.760)))))",GiNaC::lst(x));
    cout << pp << endl;

    }catch(exception &p){
      cout << p.what() <<endl;
    }
    cout << "With or without exceptions\n" <<endl;
}

(If you are thinking where I found that absurd function...well, this is
another story)

When run this program it stops and gives : "Floating point overflow". This
is related to the fact that Ginac tries to evaluate the numeric
expression. So I have two questions:

1) Why does it  not throw and exception?

2) Is it possible to stop ginac tries to evaluate the numeric expressions?


Thanks in advance,

              Alberto




More information about the GiNaC-list mailing list