X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Fnumeric.h;h=b7acbceaf5ef67d6640e352cca1ca63c1dd6ecd9;hp=b8abb189d04d853f622952ac8b1c017084162416;hb=afdd7fa8c6c0a587f7c80789198551383e8beb7b;hpb=66c0f31c678e6c1938d637636b230ea376c157c1 diff --git a/ginac/numeric.h b/ginac/numeric.h index b8abb189..b7acbcea 100644 --- a/ginac/numeric.h +++ b/ginac/numeric.h @@ -1,7 +1,8 @@ /** @file numeric.h * - * Makes the interface to the underlying bignum package available. - * + * Makes the interface to the underlying bignum package available. */ + +/* * GiNaC Copyright (C) 1999 Johannes Gutenberg University Mainz, Germany * * This program is free software; you can redistribute it and/or modify @@ -24,12 +25,17 @@ #include #include - -#define HASHVALUE_NUMERIC 0x80000001U +#include class cl_N; // We want to include cln.h only in numeric.cpp in order to // avoid namespace pollution and keep compile-time low. +#ifndef NO_GINAC_NAMESPACE +namespace GiNaC { +#endif // ndef NO_GINAC_NAMESPACE + +#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 * dumber basic type since as a side-effect we let it change @@ -73,6 +79,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); @@ -166,6 +173,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; @@ -233,10 +241,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); @@ -262,6 +274,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(); } @@ -304,20 +319,20 @@ 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)); } +// numeric evaluation functions for class constant objects: -/* do we need this any more? */ -//inline numeric binomial(int n, int k) -//{ return binomial(numeric(n), numeric(k)); } - -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); +} +#ifndef NO_GINAC_NAMESPACE +} // namespace GiNaC +#endif // ndef NO_GINAC_NAMESPACE #endif // ndef __GINAC_NUMERIC_H__