| 1 |
/** @file numeric.h |
/** @file numeric.h |
| 2 |
* |
* |
| 3 |
* Makes the interface to the underlying bignum package available. |
* Makes the interface to the underlying bignum package available. */ |
| 4 |
* |
|
| 5 |
|
/* |
| 6 |
* GiNaC Copyright (C) 1999 Johannes Gutenberg University Mainz, Germany |
* GiNaC Copyright (C) 1999 Johannes Gutenberg University Mainz, Germany |
| 7 |
* |
* |
| 8 |
* This program is free software; you can redistribute it and/or modify |
* This program is free software; you can redistribute it and/or modify |
| 25 |
|
|
| 26 |
#include <strstream> |
#include <strstream> |
| 27 |
#include <ginac/basic.h> |
#include <ginac/basic.h> |
| 28 |
|
#include <ginac/ex.h> |
|
#define HASHVALUE_NUMERIC 0x80000001U |
|
| 29 |
|
|
| 30 |
class cl_N; // We want to include cln.h only in numeric.cpp in order to |
class cl_N; // We want to include cln.h only in numeric.cpp in order to |
| 31 |
// avoid namespace pollution and keep compile-time low. |
// avoid namespace pollution and keep compile-time low. |
| 32 |
|
|
| 33 |
|
namespace GiNaC { |
| 34 |
|
|
| 35 |
|
#define HASHVALUE_NUMERIC 0x80000001U |
| 36 |
|
|
| 37 |
/** This class is used to instantiate a global object Digits which |
/** This class is used to instantiate a global object Digits which |
| 38 |
* behaves just like Maple's Digits. We need an object rather than a |
* behaves just like Maple's Digits. We need an object rather than a |
| 39 |
* dumber basic type since as a side-effect we let it change |
* dumber basic type since as a side-effect we let it change |
| 77 |
friend numeric asinh(numeric const & x); |
friend numeric asinh(numeric const & x); |
| 78 |
friend numeric acosh(numeric const & x); |
friend numeric acosh(numeric const & x); |
| 79 |
friend numeric atanh(numeric const & x); |
friend numeric atanh(numeric const & x); |
| 80 |
|
friend numeric bernoulli(numeric const & n); |
| 81 |
friend numeric abs(numeric const & x); |
friend numeric abs(numeric const & x); |
| 82 |
friend numeric mod(numeric const & a, numeric const & b); |
friend numeric mod(numeric const & a, numeric const & b); |
| 83 |
friend numeric smod(numeric const & a, numeric const & b); |
friend numeric smod(numeric const & a, numeric const & b); |
| 171 |
numeric power_dyn(numeric const & other) const { return power(other); } |
numeric power_dyn(numeric const & other) const { return power(other); } |
| 172 |
*/ |
*/ |
| 173 |
numeric inverse(void) const; |
numeric inverse(void) const; |
| 174 |
|
int csgn(void) const; |
| 175 |
int compare(numeric const & other) const; |
int compare(numeric const & other) const; |
| 176 |
bool is_equal(numeric const & other) const; |
bool is_equal(numeric const & other) const; |
| 177 |
bool is_zero(void) const; |
bool is_zero(void) const; |
| 239 |
numeric asinh(numeric const & x); |
numeric asinh(numeric const & x); |
| 240 |
numeric acosh(numeric const & x); |
numeric acosh(numeric const & x); |
| 241 |
numeric atanh(numeric const & x); |
numeric atanh(numeric const & x); |
| 242 |
|
numeric zeta(numeric const & x); |
| 243 |
numeric gamma(numeric const & x); |
numeric gamma(numeric const & x); |
| 244 |
|
numeric psi(numeric const & n, numeric const & x); |
| 245 |
numeric factorial(numeric const & n); |
numeric factorial(numeric const & n); |
| 246 |
numeric doublefactorial(numeric const & n); |
numeric doublefactorial(numeric const & n); |
| 247 |
numeric binomial(numeric const & n, numeric const & k); |
numeric binomial(numeric const & n, numeric const & k); |
| 248 |
|
numeric bernoulli(numeric const & n); |
| 249 |
|
|
| 250 |
numeric abs(numeric const & x); |
numeric abs(numeric const & x); |
| 251 |
numeric mod(numeric const & a, numeric const & b); |
numeric mod(numeric const & a, numeric const & b); |
| 271 |
inline numeric inverse(numeric const & x) |
inline numeric inverse(numeric const & x) |
| 272 |
{ return x.inverse(); } |
{ return x.inverse(); } |
| 273 |
|
|
| 274 |
|
inline bool csgn(numeric const & x) |
| 275 |
|
{ return x.csgn(); } |
| 276 |
|
|
| 277 |
inline bool is_zero(numeric const & x) |
inline bool is_zero(numeric const & x) |
| 278 |
{ return x.is_zero(); } |
{ return x.is_zero(); } |
| 279 |
|
|
| 329 |
ex EulerGammaEvalf(void); |
ex EulerGammaEvalf(void); |
| 330 |
ex CatalanEvalf(void); |
ex CatalanEvalf(void); |
| 331 |
|
|
| 332 |
#define ex_to_numeric(X) static_cast<numeric const &>(*(X).bp) |
// utility functions |
| 333 |
|
inline const numeric &ex_to_numeric(const ex &e) |
| 334 |
|
{ |
| 335 |
|
return static_cast<const numeric &>(*e.bp); |
| 336 |
|
} |
| 337 |
|
|
| 338 |
|
} // namespace GiNaC |
| 339 |
|
|
| 340 |
#endif // ndef __GINAC_NUMERIC_H__ |
#endif // ndef __GINAC_NUMERIC_H__ |