problems using plus_inf

Librairie C++ de calcul formel/ C++ symbolic computation library

Modérateur : xcasadmin

Messages : 294
Inscription : ven. juin 30, 2017 9:55 am
Localisation : Zagreb, Croatia

problems using plus_inf

Message par lukamar » mer. nov. 01, 2017 8:59 am

I have certain problems when trying to use some predefined gen such as plus_inf, zero, plus_one etc. Here's a minimal example (

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 -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.

Messages : 5084
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: problems using plus_inf

Message par parisse » mer. nov. 01, 2017 3:21 pm

I don't know what happens, it might be related to the order objects are loaded.