X-Git-Url: https://ginac.de/ginac.git//ginac.git?a=blobdiff_plain;ds=sidebyside;f=ginac%2Fnumeric.h;h=eb3565907148ffa34537f7e9b6d65afc841f26ea;hb=48b41ea321ed9fa6115a1061d1a1d2f8d8ad0400;hp=0b2d28e3e2d71f47202764186f82dade1bc715c9;hpb=6b3768e8c544739ae53321539cb4d1e3112ded1b;p=ginac.git diff --git a/ginac/numeric.h b/ginac/numeric.h index 0b2d28e3..eb356590 100644 --- a/ginac/numeric.h +++ b/ginac/numeric.h @@ -2,17 +2,37 @@ * * Makes the interface to the underlying bignum package available. */ -#ifndef _NUMERIC_H_ -#define _NUMERIC_H_ +/* + * GiNaC Copyright (C) 1999 Johannes Gutenberg University Mainz, Germany + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ -#include +#ifndef __GINAC_NUMERIC_H__ +#define __GINAC_NUMERIC_H__ -#define HASHVALUE_NUMERIC 0x80000001U +#include +#include +#include -class numeric; // Forward declaration, so basic doesn't argue... class cl_N; // We want to include cln.h only in numeric.cpp in order to // avoid namespace pollution and keep compile-time low. -#include "basic.h" + +namespace GiNaC { + +#define HASHVALUE_NUMERIC 0x80000001U /** This class is used to instantiate a global object Digits which * behaves just like Maple's Digits. We need an object rather than a @@ -57,6 +77,7 @@ class numeric : public basic friend numeric asinh(numeric const & x); friend numeric acosh(numeric const & x); friend numeric atanh(numeric const & x); + friend numeric bernoulli(numeric const & n); friend numeric abs(numeric const & x); friend numeric mod(numeric const & a, numeric const & b); friend numeric smod(numeric const & a, numeric const & b); @@ -150,6 +171,7 @@ public: numeric power_dyn(numeric const & other) const { return power(other); } */ numeric inverse(void) const; + int csgn(void) const; int compare(numeric const & other) const; bool is_equal(numeric const & other) const; bool is_zero(void) const; @@ -217,10 +239,14 @@ numeric tanh(numeric const & x); numeric asinh(numeric const & x); numeric acosh(numeric const & x); numeric atanh(numeric const & x); +numeric zeta(numeric const & x); numeric gamma(numeric const & x); +numeric psi(numeric const & x); +numeric psi(numeric const & n, numeric const & x); numeric factorial(numeric const & n); numeric doublefactorial(numeric const & n); numeric binomial(numeric const & n, numeric const & k); +numeric bernoulli(numeric const & n); numeric abs(numeric const & x); numeric mod(numeric const & a, numeric const & b); @@ -246,6 +272,9 @@ struct numeric_fail inline numeric inverse(numeric const & x) { return x.inverse(); } +inline bool csgn(numeric const & x) +{ return x.csgn(); } + inline bool is_zero(numeric const & x) { return x.is_zero(); } @@ -288,20 +317,18 @@ inline numeric numer(numeric const & x) inline numeric denom(numeric const & x) { return x.denom(); } -/* do we need this any more? */ -//inline numeric factorial(int n) -//{ return factorial(numeric(n)); } - -/* do we need this any more? */ -//inline numeric binomial(int n, int k) -//{ return binomial(numeric(n), numeric(k)); } +// numeric evaluation functions for class constant objects: -ex IEvalf(void); ex PiEvalf(void); ex EulerGammaEvalf(void); ex CatalanEvalf(void); -#define ex_to_numeric(X) static_cast(*(X).bp) +// utility functions +inline const numeric &ex_to_numeric(const ex &e) +{ + return static_cast(*e.bp); +} +} // namespace GiNaC -#endif // ndef _NUMERIC_H_ +#endif // ndef __GINAC_NUMERIC_H__