* computation, square-free factorization and rational function normalization. */
/*
- * GiNaC Copyright (C) 1999-2002 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2003 Johannes Gutenberg University Mainz, Germany
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
// Make denominator unit normal (i.e. coefficient of first symbol
// as defined by get_first_symbol() is made positive)
- const symbol *x;
- if (get_first_symbol(den, x)) {
- GINAC_ASSERT(is_exactly_a<numeric>(den.unit(*x)));
- if (ex_to<numeric>(den.unit(*x)).is_negative()) {
+ if (is_exactly_a<numeric>(den)) {
+ if (ex_to<numeric>(den).is_negative()) {
num *= _ex_1;
den *= _ex_1;
}
+ } else {
+ const symbol *x;
+ if (get_first_symbol(den, x)) {
+ GINAC_ASSERT(is_exactly_a<numeric>(den.unit(*x)));
+ if (ex_to<numeric>(den.unit(*x)).is_negative()) {
+ num *= _ex_1;
+ den *= _ex_1;
+ }
+ }
}
// Return result as list
// (a/b)^-x -> {sym((b/a)^x), 1}
return (new lst(replace_with_symbol(power(n_basis.op(1) / n_basis.op(0), -n_exponent), sym_lst, repl_lst), _ex1))->setflag(status_flags::dynallocated);
}
-
- } else { // n_exponent not numeric
-
- // (a/b)^x -> {sym((a/b)^x, 1}
- return (new lst(replace_with_symbol(power(n_basis.op(0) / n_basis.op(1), n_exponent), sym_lst, repl_lst), _ex1))->setflag(status_flags::dynallocated);
}
}
+
+ // (a/b)^x -> {sym((a/b)^x, 1}
+ return (new lst(replace_with_symbol(power(n_basis.op(0) / n_basis.op(1), n_exponent), sym_lst, repl_lst), _ex1))->setflag(status_flags::dynallocated);
}