X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?a=blobdiff_plain;f=ginac%2Fnumeric.h;h=92755b3eb390978e263646552a15fec02a0a54de;hb=8bcccf834ad41e94a1a4f3a0304c2945b228b4f4;hp=0b2d28e3e2d71f47202764186f82dade1bc715c9;hpb=6b3768e8c544739ae53321539cb4d1e3112ded1b;p=ginac.git diff --git a/ginac/numeric.h b/ginac/numeric.h index 0b2d28e3..92755b3e 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 @@ -150,6 +170,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,7 +238,9 @@ 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 & n, numeric const & x); numeric factorial(numeric const & n); numeric doublefactorial(numeric const & n); numeric binomial(numeric const & n, numeric const & k); @@ -246,6 +269,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(); } @@ -301,7 +327,12 @@ 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__