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

◆ invert()

ring_elem Z_mod::invert ( const ring_elem f) const
virtual

Implements Ring.

Definition at line 278 of file ZZp.cpp.

279{
280 int a = f.get_int();
281 if (a == _ZERO) throw exc::division_by_zero_error();
282 if (a == 0) return 0; // this is the case f == ONE
283 return ring_elem(P - 1 - a);
284}
int P
Definition ZZp.hpp:65
int _ZERO
Definition ZZp.hpp:68
int get_int() const
Definition ringelem.hpp:124

References _ZERO, ring_elem::get_int(), and P.