/[GiNaC]/ginac/numeric.h
ViewVC logotype

Diff of /ginac/numeric.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by cbauer, Wed Nov 10 19:35:49 1999 UTC revision 1.13 by kreckel, Fri Dec 10 17:23:57 1999 UTC
# Line 1  Line 1 
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
# Line 24  Line 25 
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    #ifndef NO_GINAC_NAMESPACE
34    namespace GiNaC {
35    #endif // ndef NO_GINAC_NAMESPACE
36    
37    #define HASHVALUE_NUMERIC 0x80000001U
38    
39  /** This class is used to instantiate a global object Digits which  /** This class is used to instantiate a global object Digits which
40   *  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
41   *  dumber basic type since as a side-effect we let it change   *  dumber basic type since as a side-effect we let it change
# Line 73  class numeric : public basic Line 79  class numeric : public basic
79      friend numeric asinh(numeric const & x);      friend numeric asinh(numeric const & x);
80      friend numeric acosh(numeric const & x);      friend numeric acosh(numeric const & x);
81      friend numeric atanh(numeric const & x);      friend numeric atanh(numeric const & x);
82        friend numeric bernoulli(numeric const & n);
83      friend numeric abs(numeric const & x);      friend numeric abs(numeric const & x);
84      friend numeric mod(numeric const & a, numeric const & b);      friend numeric mod(numeric const & a, numeric const & b);
85      friend numeric smod(numeric const & a, numeric const & b);      friend numeric smod(numeric const & a, numeric const & b);
# Line 166  public: Line 173  public:
173      numeric power_dyn(numeric const & other) const { return power(other); }      numeric power_dyn(numeric const & other) const { return power(other); }
174      */      */
175      numeric inverse(void) const;      numeric inverse(void) const;
176        int csgn(void) const;
177      int compare(numeric const & other) const;      int compare(numeric const & other) const;
178      bool is_equal(numeric const & other) const;      bool is_equal(numeric const & other) const;
179      bool is_zero(void) const;      bool is_zero(void) const;
# Line 179  public: Line 187  public:
187      bool is_prime(void) const;      bool is_prime(void) const;
188      bool is_rational(void) const;      bool is_rational(void) const;
189      bool is_real(void) const;      bool is_real(void) const;
190        bool is_cinteger(void) const;
191        bool is_crational(void) const;
192      bool operator==(numeric const & other) const;      bool operator==(numeric const & other) const;
193      bool operator!=(numeric const & other) const;      bool operator!=(numeric const & other) const;
194      bool operator<(numeric const & other) const;      bool operator<(numeric const & other) const;
# Line 233  numeric tanh(numeric const & x); Line 243  numeric tanh(numeric const & x);
243  numeric asinh(numeric const & x);  numeric asinh(numeric const & x);
244  numeric acosh(numeric const & x);  numeric acosh(numeric const & x);
245  numeric atanh(numeric const & x);  numeric atanh(numeric const & x);
246    numeric zeta(numeric const & x);
247  numeric gamma(numeric const & x);  numeric gamma(numeric const & x);
248    numeric psi(numeric const & x);
249    numeric psi(numeric const & n, numeric const & x);
250  numeric factorial(numeric const & n);  numeric factorial(numeric const & n);
251  numeric doublefactorial(numeric const & n);  numeric doublefactorial(numeric const & n);
252  numeric binomial(numeric const & n, numeric const & k);  numeric binomial(numeric const & n, numeric const & k);
253    numeric bernoulli(numeric const & n);
254    
255  numeric abs(numeric const & x);  numeric abs(numeric const & x);
256  numeric mod(numeric const & a, numeric const & b);  numeric mod(numeric const & a, numeric const & b);
# Line 262  struct numeric_fail Line 276  struct numeric_fail
276  inline numeric inverse(numeric const & x)  inline numeric inverse(numeric const & x)
277  { return x.inverse(); }  { return x.inverse(); }
278    
279    inline bool csgn(numeric const & x)
280    { return x.csgn(); }
281    
282  inline bool is_zero(numeric const & x)  inline bool is_zero(numeric const & x)
283  { return x.is_zero(); }  { return x.is_zero(); }
284    
# Line 304  inline numeric numer(numeric const & x) Line 321  inline numeric numer(numeric const & x)
321  inline numeric denom(numeric const & x)  inline numeric denom(numeric const & x)
322  { return x.denom(); }  { return x.denom(); }
323    
324  /* do we need this any more? */  // numeric evaluation functions for class constant objects:
 //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)); }  
325    
 ex IEvalf(void);  
326  ex PiEvalf(void);  ex PiEvalf(void);
327  ex EulerGammaEvalf(void);  ex EulerGammaEvalf(void);
328  ex CatalanEvalf(void);  ex CatalanEvalf(void);
329    
330  #define ex_to_numeric(X) static_cast<numeric const &>(*(X).bp)  // utility functions
331    inline const numeric &ex_to_numeric(const ex &e)
332    {
333            return static_cast<const numeric &>(*e.bp);
334    }
335    
336    #ifndef NO_GINAC_NAMESPACE
337    } // namespace GiNaC
338    #endif // ndef NO_GINAC_NAMESPACE
339    
340  #endif // ndef __GINAC_NUMERIC_H__  #endif // ndef __GINAC_NUMERIC_H__

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.13

Christian Bauer">Christian Bauer
ViewVC Help
Powered by ViewVC 1.1.15