From: Richard Kreckel Date: Fri, 4 Aug 2000 16:36:55 +0000 (+0000) Subject: - Check *this for zeroness before .invert()ing it. X-Git-Tag: release_0-6-4~5 X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=commitdiff_plain;h=464c1a74eec40b337738483cc25338f543d86e92 - Check *this for zeroness before .invert()ing it. --- diff --git a/ginac/numeric.cpp b/ginac/numeric.cpp index bfa00af6..0df296eb 100644 --- a/ginac/numeric.cpp +++ b/ginac/numeric.cpp @@ -716,7 +716,7 @@ numeric numeric::mul(const numeric & other) const numeric numeric::div(const numeric & other) const { if (::zerop(*other.value)) - throw std::overflow_error("division by zero"); + throw std::overflow_error("numeric::div(): division by zero"); return numeric((*value)/(*other.value)); } @@ -741,6 +741,8 @@ numeric numeric::power(const numeric & other) const /** Inverse of a number. */ numeric numeric::inverse(void) const { + if (::zerop(*value)) + throw std::overflow_error("numeric::inverse(): division by zero"); return numeric(::recip(*value)); // -> CLN }