X-Git-Url: https://ginac.de/CLN/cln.git//cln.git?a=blobdiff_plain;f=src%2Fmodinteger%2Fcl_MI_int.h;h=f8e6f788dc5a8267a55d859f3d645a4f131e6a2a;hb=8169a19b38c42588b39b21dae5bdb964e2f6b8c6;hp=fe70d498efc5df4153fd29cdd93539acf9129e4e;hpb=f3b29e52ea5a7b013f8294065920365e5d17d18f;p=cln.git diff --git a/src/modinteger/cl_MI_int.h b/src/modinteger/cl_MI_int.h index fe70d49..f8e6f78 100644 --- a/src/modinteger/cl_MI_int.h +++ b/src/modinteger/cl_MI_int.h @@ -31,8 +31,7 @@ static const _cl_MI int_random (cl_heap_modint_ring* R, random_state& randomstat { unused R; unused randomstate; - fprint(std::cerr, "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 @@ -43,7 +42,7 @@ static const _cl_MI int_zero (cl_heap_modint_ring* R) 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); @@ -83,7 +82,7 @@ static const cl_MI_x int_recip (cl_heap_modint_ring* R, const _cl_MI& x) { 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); } @@ -92,7 +91,7 @@ static const cl_MI_x int_div (cl_heap_modint_ring* R, const _cl_MI& x, const _cl 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); } @@ -112,7 +111,7 @@ static const cl_MI_x int_expt (cl_heap_modint_ring* R, const _cl_MI& x, const cl 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); }