Page 1 sur 1

problems using plus_inf

Publié : mer. nov. 01, 2017 8:59 am
par lukamar
Hi,
I have certain problems when trying to use some predefined gen such as plus_inf, zero, plus_one etc. Here's a minimal example (test.cc):

Code : Tout sélectionner

#include <giac/config.h>
#include <giac/gen.h>
#include <giac/unary.h>
#include <giac/giac.h>
#include <iostream>
using namespace giac;
using namespace std;

int main() {
gen g(plus_inf);
cout << g << endl;
return 0;
}
This program segfaults after being compiled with

Code : Tout sélectionner

g++ -Wall -g test.cc -lgiac -lgmp
But when i replace "gen g(plus_inf)" with

Code : Tout sélectionner

gen g(unsigned_inf)
the program works fine. As I see, unsigned_inf is defined using the identificateur constructor, while plus_inf is defined as symbolic(at_plus,unsigned_inf). I would like to understand what leads to crash. However, It's not a big deal if it remains unclear, as I can easily redefine infinities by copying the above mentioned definition from your code:

Code : Tout sélectionner

gen g=symbolic(at_plus,unsigned_inf);
It works as expected.

Re: problems using plus_inf

Publié : mer. nov. 01, 2017 3:21 pm
par parisse
I don't know what happens, it might be related to the order objects are loaded.