From 464c1a74eec40b337738483cc25338f543d86e92 Mon Sep 17 00:00:00 2001 From: Richard Kreckel Date: Fri, 4 Aug 2000 16:36:55 +0000 Subject: [PATCH] - Check *this for zeroness before .invert()ing it. --- ginac/numeric.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 } -- 2.44.0