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

Diff of /ginac/numeric.h

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

revision 1.45 by cbauer, Thu Feb 15 19:54:55 2001 UTC revision 1.52 by kreckel, Tue Jun 5 09:55:06 2001 UTC
# Line 23  Line 23 
23  #ifndef __GINAC_NUMERIC_H__  #ifndef __GINAC_NUMERIC_H__
24  #define __GINAC_NUMERIC_H__  #define __GINAC_NUMERIC_H__
25    
 #include <strstream>  
26  #include "basic.h"  #include "basic.h"
27  #include "ex.h"  #include "ex.h"
28    
# Line 38  namespace cln { class cl_N; } Line 37  namespace cln { class cl_N; }
37    #include <cln/complex_class.h>    #include <cln/complex_class.h>
38  #endif  #endif
39    
 #ifndef NO_NAMESPACE_GINAC  
40  namespace GiNaC {  namespace GiNaC {
 #endif // ndef NO_NAMESPACE_GINAC  
41    
42  #define HASHVALUE_NUMERIC 0x80000001U  #define HASHVALUE_NUMERIC 0x80000001U
43    
44  /** This class is used to instantiate a global object Digits which  /** This class is used to instantiate a global singleton object Digits
45   *  behaves just like Maple's Digits.  We need an object rather than a   *  which behaves just like Maple's Digits.  We need an object rather
46   *  dumber basic type since as a side-effect we let it change   *  than a dumber basic type since as a side-effect we let it change
47   *  cl_default_float_format when it gets changed.  The only other   *  cl_default_float_format when it gets changed.  The only other
48   *  meaningful thing to do with it is converting it to an unsigned,   *  meaningful thing to do with it is converting it to an unsigned,
49   *  for temprary storing its value e.g.  The user must not create an   *  for temprary storing its value e.g.  The user must not create an
# Line 63  public: Line 60  public:
60          void print(std::ostream & os) const;          void print(std::ostream & os) const;
61  // member variables  // member variables
62  private:  private:
63          long digits;          long digits;                        ///< Number of decimal digits
64          static bool too_late;          static bool too_late;               ///< Already one object present
65  };  };
66    
67  /** This class is a wrapper around CLN-numbers within the GiNaC class  /** This class is a wrapper around CLN-numbers within the GiNaC class
# Line 75  class numeric : public basic Line 72  class numeric : public basic
72    
73  // member functions  // member functions
74    
75          // other constructors          // other ctors
76  public:  public:
77          explicit numeric(int i);          explicit numeric(int i);
78          explicit numeric(unsigned int i);          explicit numeric(unsigned int i);
# Line 87  public: Line 84  public:
84    
85          // functions overriding virtual functions from bases classes          // functions overriding virtual functions from bases classes
86  public:  public:
87          basic * duplicate() const;          void print(const print_context & c, unsigned level = 0) const;
88          void print(std::ostream & os, unsigned precedence=0) const;          unsigned precedence(void) const {return 30;}
         void printraw(std::ostream & os) const;  
         void printtree(std::ostream & os, unsigned indent) const;  
         void printcsrc(std::ostream & os, unsigned type, unsigned precedence=0) const;  
89          bool info(unsigned inf) const;          bool info(unsigned inf) const;
90          bool has(const ex & other) const;          bool has(const ex & other) const;
91          ex eval(int level=0) const;          ex eval(int level=0) const;
# Line 102  public: Line 96  public:
96          ex smod(const numeric &xi) const;          ex smod(const numeric &xi) const;
97          numeric max_coefficient(void) const;          numeric max_coefficient(void) const;
98  protected:  protected:
99          ex derivative(const symbol & s) const;          /** Implementation of ex::diff for a numeric always returns 0.
100          int compare_same_type(const basic & other) const;           *  @see ex::diff */
101            ex derivative(const symbol &s) const { return _ex0(); }
102          bool is_equal_same_type(const basic & other) const;          bool is_equal_same_type(const basic & other) const;
103          unsigned calchash(void) const;          unsigned calchash(void) const;
104    
# Line 166  public: Line 161  public:
161  // member variables  // member variables
162    
163  protected:  protected:
         static unsigned precedence;  
164          cln::cl_number value;          cln::cl_number value;
165  };  };
166    
# Line 175  protected: Line 169  protected:
169  extern const numeric I;  extern const numeric I;
170  extern _numeric_digits Digits;  extern _numeric_digits Digits;
171    
172  //#define is_a_numeric_hash(x) ((x)==HASHVALUE_NUMERIC)  // deprecated macro, for internal use only
173  // may have to be changed to ((x)>=0x80000000U)  #define is_a_numeric_hash(x) ((x)&0x80000000U)
   
 // has been changed  
 //#define is_a_numeric_hash(x) ((x)&0x80000000U)  
174    
175  // global functions  // global functions
176    
# Line 209  const numeric doublefactorial(const nume Line 200  const numeric doublefactorial(const nume
200  const numeric binomial(const numeric & n, const numeric & k);  const numeric binomial(const numeric & n, const numeric & k);
201  const numeric bernoulli(const numeric & n);  const numeric bernoulli(const numeric & n);
202  const numeric fibonacci(const numeric & n);  const numeric fibonacci(const numeric & n);
 const numeric abs(const numeric & x);  
203  const numeric isqrt(const numeric & x);  const numeric isqrt(const numeric & x);
204  const numeric sqrt(const numeric & x);  const numeric sqrt(const numeric & x);
205  const numeric abs(const numeric & x);  const numeric abs(const numeric & x);
# Line 302  inline const numeric &ex_to_numeric(cons Line 292  inline const numeric &ex_to_numeric(cons
292          return static_cast<const numeric &>(*e.bp);          return static_cast<const numeric &>(*e.bp);
293  }  }
294    
   
 #ifndef NO_NAMESPACE_GINAC  
295  } // namespace GiNaC  } // namespace GiNaC
 #endif // ndef NO_NAMESPACE_GINAC  
296    
297  #ifdef __MAKECINT__  #ifdef __MAKECINT__
298  #pragma link off defined_in cln/number.h;  #pragma link off defined_in cln/number.h;

Legend:
Removed from v.1.45  
changed lines
  Added in v.1.52

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