// m = 0 : Z/mZ \isomorph Z
-static void int_fprint (cl_heap_modint_ring* R, cl_ostream stream, const _cl_MI &x)
+namespace cln {
+
+static void int_fprint (cl_heap_modint_ring* R, std::ostream& stream, const _cl_MI &x)
{
fprint(stream,R->_retract(x));
}
}
// This is the only case where random yields an error.
-static const _cl_MI int_random (cl_heap_modint_ring* R, cl_random_state& randomstate)
+static const _cl_MI int_random (cl_heap_modint_ring* R, random_state& randomstate)
{
unused R;
unused randomstate;
- fprint(cl_stderr, "Z / 0 Z not a finite set - no equidistributed random function.\n");
- cl_abort();
+ throw runtime_exception("Z / 0 Z not a finite set - no equidistributed random function.");
#if ((defined(__sparc__) || defined(__sparc64__)) && !defined(__GNUC__)) // Sun CC wants a return value
return _cl_MI(R, 0);
#endif
return _cl_MI(R, 0);
}
-static cl_boolean int_zerop (cl_heap_modint_ring* R, const _cl_MI& x)
+static bool int_zerop (cl_heap_modint_ring* R, const _cl_MI& x)
{
unused R;
return zerop(x.rep);
{
var const cl_I& xr = x.rep;
if (eq(xr,1) || eq(xr,-1)) { return cl_MI(R,x); }
- if (zerop(xr)) { cl_error_division_by_0(); }
+ if (zerop(xr)) { throw division_by_0_exception(); }
return cl_notify_composite(R,xr);
}
var const cl_I& yr = y.rep;
if (eq(yr,1)) { return cl_MI(R,x.rep); }
if (eq(yr,-1)) { return cl_MI(R,-x.rep); }
- if (zerop(yr)) { cl_error_division_by_0(); }
+ if (zerop(yr)) { throw division_by_0_exception(); }
return cl_notify_composite(R,yr);
}
return cl_MI(R,expt_pos(x.rep,y));
}
// y < 0, x nonunit.
- if (zerop(x.rep)) { cl_error_division_by_0(); }
+ if (zerop(x.rep)) { throw division_by_0_exception(); }
return cl_notify_composite(R,x.rep);
}
// Virtual destructor.
~cl_heap_modint_ring_int () {}
};
+
+} // namespace cln