FLINT3.7.0-dev

gr_pow, gr_pow_ui, gr_pow_si, gr_pow_fmpz, gr_pow_fmpq, gr_pow_other, gr_other_pow

Synopsis#include <flint/gr.h>
int gr_pow(gr_ptr res, gr_srcptr x, gr_srcptr y, gr_ctx_t ctx)source
int gr_pow_ui(gr_ptr res, gr_srcptr x, ulong y, gr_ctx_t ctx)source
int gr_pow_si(gr_ptr res, gr_srcptr x, slong y, gr_ctx_t ctx)source
int gr_pow_fmpz(gr_ptr res, gr_srcptr x, const fmpz_t y, gr_ctx_t ctx)source
int gr_pow_fmpq(gr_ptr res, gr_srcptr x, const fmpq_t y, gr_ctx_t ctx)source
int gr_pow_other(gr_ptr res, gr_srcptr x, gr_srcptr y, gr_ctx_t y_ctx, gr_ctx_t ctx)source
int gr_other_pow(gr_ptr res, gr_srcptr x, gr_ctx_t x_ctx, gr_srcptr y, gr_ctx_t ctx)source

Set res to x^y. Fail with GR_DOMAIN if the power has no value in the ring (for example 0^{-1}, 2^{-1} in \mathbb{Z}, (-1)^{1/2} in \mathbb{R}).

For integer exponents the default implementations use binary exponentiation, inverting x first when the exponent is negative (gr_generic_pow_ui, gr_generic_pow_fmpz). For y = p/2 the default of gr_pow_fmpq uses gr_sqrt or gr_rsqrt and then an integer power; other rational exponents are converted to the ring and passed to gr_pow. In subrings of \mathbb{C} a non-integer power is the principal branch x^y = \exp(y \log x) for x \ne 0. In other rings the meaning of a non-integer power is defined by the ring; most return GR_UNABLE.

Guides#

Cite this page

The FLINT team, “gr_pow, gr_pow_ui, gr_pow_si, gr_pow_fmpz, gr_pow_fmpq, gr_pow_other, gr_other_pow (gr.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/gr/gr_pow.html (generated 2026-10-20).