Parenthesization bug

Richard B. Kreckel kreckel at thep.physik.uni-mainz.de
Fri Jan 25 14:52:36 CET 2002


Hi,

On Fri, 25 Jan 2002, Roberto Bagnara wrote:
> there is a bug somewhere in GiNaC whereby some non-redundant parentheses
> are not output.  The problem is shown below by means of simple `ginsh'
> session, but it can be reproduced equally well with C++ code.
> 
> $ ginsh
> ginsh - GiNaC Interactive Shell (GiNaC V1.0.4)
>   __,  _______  Copyright (C) 1999-2002 Johannes Gutenberg University Mainz,
>  (__) *       | Germany.  This is free software with ABSOLUTELY NO WARRANTY.
>   ._) i N a C | You are welcome to redistribute it under certain conditions.
> <-------------' For details type `warranty;'.
> 
> Type ?? for a list of help topics.
> > 2*I^(1/3);
> 2*I^(1/3)
> > (2*I)^(1/3);
> 2*I^(1/3)
> > 2*(I^(1/3));
> 2*I^(1/3)
> > 
> 
> If this is confirmed to be a bug, we would need to develop a fix or
> a workaround quite urgently.

Indeed, it's a bug.  Internally, these are differnt objects.  It just
seems to be their output, i.e. power::print().  Look at this:
> (2*I)^(1/3);
2*I^(1/3)
> print(%);
power, hash=0xbffff638, flags=0x3, nops=2
    2i (numeric), hash=0x80000840, flags=0xf
    1/3 (numeric), hash=0x80000020, flags=0xf

Can you look into that method?

Regards
    -richy.
-- 
Richard B. Kreckel
<Richard.Kreckel at Uni-Mainz.DE>
<http://wwwthep.physik.uni-mainz.de/~kreckel/>





More information about the GiNaC-devel mailing list