From: Richard Kreckel Date: Tue, 9 Apr 2002 21:17:06 +0000 (+0000) Subject: * Added documentation for the add_dyn(), mul_dyn()... methods. X-Git-Tag: release_1-1-0~105 X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?a=commitdiff_plain;h=8c957d0e11b6819d3b648e8548141cbff5792e2a;p=ginac.git * Added documentation for the add_dyn(), mul_dyn()... methods. --- diff --git a/ginac/numeric.cpp b/ginac/numeric.cpp index de7ffdad..1643eebd 100644 --- a/ginac/numeric.cpp +++ b/ginac/numeric.cpp @@ -669,6 +669,10 @@ const numeric numeric::power(const numeric &other) const } + +/** Numerical addition method. Adds argument to *this and returns result as + * a numeric object on the heap. Use internally only for direct wrapping into + * an ex object, where the result would end up on the heap anyways. */ const numeric &numeric::add_dyn(const numeric &other) const { // Efficiency shortcut: trap the neutral element by pointer. @@ -678,17 +682,25 @@ const numeric &numeric::add_dyn(const numeric &other) const return *this; return static_cast((new numeric(cln::the(value)+cln::the(other.value)))-> - setflag(status_flags::dynallocated)); + setflag(status_flags::dynallocated)); } +/** Numerical subtraction method. Subtracts argument from *this and returns + * result as a numeric object on the heap. Use internally only for direct + * wrapping into an ex object, where the result would end up on the heap + * anyways. */ const numeric &numeric::sub_dyn(const numeric &other) const { return static_cast((new numeric(cln::the(value)-cln::the(other.value)))-> - setflag(status_flags::dynallocated)); + setflag(status_flags::dynallocated)); } +/** Numerical multiplication method. Multiplies *this and argument and returns + * result as a numeric object on the heap. Use internally only for direct + * wrapping into an ex object, where the result would end up on the heap + * anyways. */ const numeric &numeric::mul_dyn(const numeric &other) const { // Efficiency shortcut: trap the neutral element by pointer. @@ -698,19 +710,29 @@ const numeric &numeric::mul_dyn(const numeric &other) const return *this; return static_cast((new numeric(cln::the(value)*cln::the(other.value)))-> - setflag(status_flags::dynallocated)); + setflag(status_flags::dynallocated)); } +/** Numerical division method. Divides *this by argument and returns result as + * a numeric object on the heap. Use internally only for direct wrapping + * into an ex object, where the result would end up on the heap + * anyways. + * + * @exception overflow_error (division by zero) */ const numeric &numeric::div_dyn(const numeric &other) const { if (cln::zerop(cln::the(other.value))) throw std::overflow_error("division by zero"); return static_cast((new numeric(cln::the(value)/cln::the(other.value)))-> - setflag(status_flags::dynallocated)); + setflag(status_flags::dynallocated)); } +/** Numerical exponentiation. Raises *this to the power given as argument and + * returns result as a numeric object on the heap. Use internally only for + * direct wrapping into an ex object, where the result would end up on the + * heap anyways. */ const numeric &numeric::power_dyn(const numeric &other) const { // Efficiency shortcut: trap the neutral exponent by pointer.