X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Fnormal.cpp;h=d23b2289d520aa535bd0dd6fb43b6e43080536a7;hp=a5ebeb8b691ee4b6d95355fff45a17d68d87a414;hb=2db113296f65f8fd3a0d62781ddc9276ff07b487;hpb=510fe21487d84c76cc779749490c13f92a3312af diff --git a/ginac/normal.cpp b/ginac/normal.cpp index a5ebeb8b..d23b2289 100644 --- a/ginac/normal.cpp +++ b/ginac/normal.cpp @@ -1574,19 +1574,20 @@ ex power::normal(lst &sym_lst, lst &repl_lst, int level) const // (a/b)^n -> {a^n, b^n} return (new lst(power(n.op(0), exponent), power(n.op(1), exponent)))->setflag(status_flags::dynallocated); - } else if (exponent.info(info_flags::negint)) { + } else if (exponent.info(info_flags::negative)) { // (a/b)^-n -> {b^n, a^n} return (new lst(power(n.op(1), -exponent), power(n.op(0), -exponent)))->setflag(status_flags::dynallocated); } } else { + if (exponent.info(info_flags::positive)) { - // (a/b)^z -> {sym((a/b)^z), 1} + // (a/b)^x -> {sym((a/b)^x), 1} return (new lst(replace_with_symbol(power(n.op(0) / n.op(1), exponent), sym_lst, repl_lst), _ex1()))->setflag(status_flags::dynallocated); - } else { + } else if (exponent.info(info_flags::negative)) { if (n.op(1).is_equal(_ex1())) { @@ -1595,9 +1596,14 @@ ex power::normal(lst &sym_lst, lst &repl_lst, int level) const } else { - // (a/b)^-x -> {(b/a)^x, 1} + // (a/b)^-x -> {sym((b/a)^x), 1} return (new lst(replace_with_symbol(power(n.op(1) / n.op(0), -exponent), sym_lst, repl_lst), _ex1()))->setflag(status_flags::dynallocated); } + + } else { // exponent not numeric + + // (a/b)^x -> {sym((a/b)^x, 1} + return (new lst(replace_with_symbol(power(n.op(0) / n.op(1), exponent), sym_lst, repl_lst), _ex1()))->setflag(status_flags::dynallocated); } } }