]> www.ginac.de Git - ginac.git/blobdiff - ginac/numeric.h
* Fix a bitch of a bug where 1<I (and all other relationals) returned true.
[ginac.git] / ginac / numeric.h
index 4f2ba1a1e3b4fa9c7c147f8f5082e27513e6357f..71781f4b8a5ef3ab68814a5d0f40982804d25e85 100644 (file)
@@ -39,8 +39,6 @@ namespace cln { class cl_N; }
 
 namespace GiNaC {
 
-#define HASHVALUE_NUMERIC 0x80000001U
-
 /** This class is used to instantiate a global singleton 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
@@ -85,6 +83,7 @@ public:
        // functions overriding virtual functions from bases classes
 public:
        void print(const print_context & c, unsigned level = 0) const;
+       unsigned precedence(void) const {return 30;}
        bool info(unsigned inf) const;
        bool has(const ex &other) const;
        ex eval(int level = 0) const;
@@ -160,7 +159,6 @@ public:
 // member variables
 
 protected:
-       static unsigned precedence;
        cln::cl_number value;
 };
 
@@ -200,7 +198,6 @@ const numeric doublefactorial(const numeric &n);
 const numeric binomial(const numeric &n, const numeric &k);
 const numeric bernoulli(const numeric &n);
 const numeric fibonacci(const numeric &n);
-const numeric abs(const numeric &x);
 const numeric isqrt(const numeric &x);
 const numeric sqrt(const numeric &x);
 const numeric abs(const numeric &x);
@@ -288,11 +285,20 @@ ex CatalanEvalf(void);
 
 
 // utility functions
+
+/** Return the numeric object handled by an ex.  Deprecated: use ex_to<numeric>().
+ *  This is unsafe: you need to check the type first. */
 inline const numeric &ex_to_numeric(const ex &e)
 {
        return static_cast<const numeric &>(*e.bp);
 }
 
+/** Specialization of is_exactly_a<numeric>(obj) for numeric objects. */
+template<> inline bool is_exactly_a<numeric>(const basic & obj)
+{
+       return obj.tinfo()==TINFO_numeric;
+}
+
 } // namespace GiNaC
 
 #ifdef __MAKECINT__