On Friday, August 30, 2024 at 5:53:15 PM UTC+9 vdelecroix wrote: Let me mention that this question of powering is intimately related to the question whether the powering operator should be part of the coercion model. This has been done by Jeroen Demeyer years ago in 2017 (see https://github.com/sagemath/sage/issues/24247). Unless we revert this, the parent of a**b should only depend on parent(a) and parent(b) (whatever values have a and b).
The gist of what Jeroen Demeyer did in #24247 seems to separate out integer powering from the general case. The general case x^y is treated like binary operation between two elements in the parent. Integer powering x^n is treated as an action of n to x. Fractional powering x^(p/q) is already dealt with the same action. The parent of the result of x^n or x^(p/q) is determined depending on the exponent, not only on parent(x): sage: ZZ(-8)^(-3) -1/512 sage: _.parent() Rational Field -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/64d5daf4-bcb3-451c-a007-1271a80ca144n%40googlegroups.com.