[GiNaC-devel] printing of class power
Richard B. Kreckel
kreckel at in.terlu.de
Tue Jan 7 09:51:15 CET 2025
Dear Stefan,
On 1/7/25 12:12 AM, Stefan Weinzierl wrote:
> I am not sure if one actually needs the extra method
> power::do_print_tree,
> a program seems to do the same thing with or without,
It is not the same, even when the exponent is not 1/2. Without it, we
dispatch to power::do_print() which passes the 'print_tree' context down
to basis and exponent and for x^5 that gives us something like:
x (symbol)
@0x559db0cc2f70, serial=2, hash=0x6f41b8a, flags=0xf, domain=0
^ 5 (numeric)
@0x559db0cb3c90, hash=0xa5fe3ba7, flags=0xf
(Note the caret and the indentation.) We really want to pick up
basic::do_print_tree() here.
> and I don't see it defined in the classes add and mul neither.
The methods add::do_print_tree() and mul::do_print_tree() are registered
in the classes' print dispatch tables (add.cpp:42 and mul.cpp:45).
All my best,
-richy.
--
Richard B. Kreckel
<https://in.terlu.de/~kreckel/>
More information about the GiNaC-devel
mailing list