Macaulay2 Engine
Loading...
Searching...
No Matches

◆ power_mpz()

void M2::ARingZZp::power_mpz ( elem & result,
elem a,
mpz_srcptr n ) const
inline

Definition at line 307 of file aring-zzp.hpp.

308 {
309 if (a != 0)
310 {
311 int n1 = static_cast<int>(mpz_fdiv_ui(n, p1));
312 power(result, a, n1);
313 }
314 else
315 {
316 if (mpz_sgn(n) == 0) result = p1; // the element 1 in this ring.
317 else if (mpz_sgn(n) < 0) throw exc::division_by_zero_error();
318 else result = 0; // result is 0 in the ring.
319 }
320 }
void power(elem &result, elem a, int n) const
VALGRIND_MAKE_MEM_DEFINED & result(result)

References p1, power(), and result().