X-Git-Url: https://ginac.de/CLN/cln.git//cln.git?a=blobdiff_plain;f=src%2Fpolynomial%2Felem%2Fcl_UP_number.h;h=b6cb8a843bac1772cb32681678c177547b76665a;hb=5370ad8054201cf23d4f94a52f4d3f7f9f3cd511;hp=4b8e906caeb36d7e39edd998c85c1930b13fc51d;hpb=e269351d5421e590aa093dacaed90ff46f4b2aa9;p=cln.git diff --git a/src/polynomial/elem/cl_UP_number.h b/src/polynomial/elem/cl_UP_number.h index 4b8e906..b6cb8a8 100644 --- a/src/polynomial/elem/cl_UP_number.h +++ b/src/polynomial/elem/cl_UP_number.h @@ -3,7 +3,7 @@ #include "cln/SV_number.h" #include "cln/number.h" #include "cln/integer.h" -#include "cln/abort.h" +#include "cln/exception.h" namespace cln { @@ -56,7 +56,7 @@ static void num_fprint (cl_heap_univpoly_ring* UPR, std::ostream& stream, const } }} -static cl_boolean num_equal (cl_heap_univpoly_ring* UPR, const _cl_UP& x, const _cl_UP& y) +static bool num_equal (cl_heap_univpoly_ring* UPR, const _cl_UP& x, const _cl_UP& y) {{ DeclarePoly(cl_SV_number,x); DeclarePoly(cl_SV_number,y); @@ -64,11 +64,11 @@ static cl_boolean num_equal (cl_heap_univpoly_ring* UPR, const _cl_UP& x, const var sintL xlen = x.length(); var sintL ylen = y.length(); if (!(xlen == ylen)) - return cl_false; + return false; for (var sintL i = xlen-1; i >= 0; i--) if (!ops.equal(x[i],y[i])) - return cl_false; - return cl_true; + return false; + return true; }} static const _cl_UP num_zero (cl_heap_univpoly_ring* UPR) @@ -76,15 +76,15 @@ static const _cl_UP num_zero (cl_heap_univpoly_ring* UPR) return _cl_UP(UPR, cl_null_SV_number); } -static cl_boolean num_zerop (cl_heap_univpoly_ring* UPR, const _cl_UP& x) +static bool num_zerop (cl_heap_univpoly_ring* UPR, const _cl_UP& x) { unused UPR; { DeclarePoly(cl_SV_number,x); var sintL xlen = x.length(); if (xlen == 0) - return cl_true; + return true; else - return cl_false; + return false; }} static const _cl_UP num_plus (cl_heap_univpoly_ring* UPR, const _cl_UP& x, const _cl_UP& y) @@ -142,7 +142,7 @@ static const _cl_UP num_uminus (cl_heap_univpoly_ring* UPR, const _cl_UP& x) // Negate. No normalization necessary, since the degree doesn't change. var sintL i = xlen-1; var cl_number hicoeff = ops.uminus(x[i]); - if (ops.zerop(hicoeff)) cl_abort(); + if (ops.zerop(hicoeff)) throw runtime_exception(); var cl_SV_number result = cl_SV_number(cl_make_heap_SV_number_uninit(xlen)); init1(cl_number, result[i]) (hicoeff); for (i-- ; i >= 0; i--) @@ -251,7 +251,7 @@ static const _cl_UP num_mul (cl_heap_univpoly_ring* UPR, const _cl_UP& x, const } // Normalize (not necessary in integral domains). //num_normalize(ops,result,len); - if (ops.zerop(result[len-1])) cl_abort(); + if (ops.zerop(result[len-1])) throw runtime_exception(); return _cl_UP(UPR, result); }} @@ -290,7 +290,7 @@ static const _cl_UP num_square (cl_heap_univpoly_ring* UPR, const _cl_UP& x) init1(cl_number, result[0]) (ops.square(x[0])); // Normalize (not necessary in integral domains). //num_normalize(ops,result,len); - if (ops.zerop(result[len-1])) cl_abort(); + if (ops.zerop(result[len-1])) throw runtime_exception(); return _cl_UP(UPR, result); }} @@ -310,7 +310,7 @@ static const _cl_UP num_exptpos (cl_heap_univpoly_ring* UPR, const _cl_UP& x, co static const _cl_UP num_scalmul (cl_heap_univpoly_ring* UPR, const cl_ring_element& x, const _cl_UP& y) { - if (!(UPR->basering() == x.ring())) cl_abort(); + if (!(UPR->basering() == x.ring())) throw runtime_exception(); { DeclarePoly(cl_number,x); DeclarePoly(cl_SV_number,y); @@ -349,7 +349,7 @@ static sintL num_ldegree (cl_heap_univpoly_ring* UPR, const _cl_UP& x) static const _cl_UP num_monomial (cl_heap_univpoly_ring* UPR, const cl_ring_element& x, uintL e) { - if (!(UPR->basering() == x.ring())) cl_abort(); + if (!(UPR->basering() == x.ring())) throw runtime_exception(); { DeclarePoly(cl_number,x); var cl_number_ring_ops& ops = *TheNumberRing(UPR->basering())->ops; if (ops.zerop(x)) @@ -385,9 +385,9 @@ static const _cl_UP num_create (cl_heap_univpoly_ring* UPR, sintL deg) static void num_set_coeff (cl_heap_univpoly_ring* UPR, _cl_UP& x, uintL index, const cl_ring_element& y) {{ DeclareMutablePoly(cl_SV_number,x); - if (!(UPR->basering() == y.ring())) cl_abort(); + if (!(UPR->basering() == y.ring())) throw runtime_exception(); { DeclarePoly(cl_number,y); - if (!(index < x.length())) cl_abort(); + if (!(index < x.length())) throw runtime_exception(); x[index] = y; }}} @@ -407,7 +407,7 @@ static const cl_ring_element num_eval (cl_heap_univpoly_ring* UPR, const _cl_UP& // If y = 0, return x[0]. // Else compute (...(x[len-1]*y+x[len-2])*y ...)*y + x[0]. DeclarePoly(cl_SV_number,x); - if (!(UPR->basering() == y.ring())) cl_abort(); + if (!(UPR->basering() == y.ring())) throw runtime_exception(); { DeclarePoly(cl_number,y); var cl_heap_number_ring* R = TheNumberRing(UPR->basering()); var cl_number_ring_ops& ops = *R->ops;