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
// other ctors
public:
- explicit numeric(int i);
- explicit numeric(unsigned int i);
- explicit numeric(long i);
- explicit numeric(unsigned long i);
- explicit numeric(long numer, long denom);
- explicit numeric(double d);
- explicit numeric(const char *);
+ numeric(int i);
+ numeric(unsigned int i);
+ numeric(long i);
+ numeric(unsigned long i);
+ numeric(long numer, long denom);
+ numeric(double d);
+ numeric(const char *);
- // functions overriding virtual functions from bases classes
+ // functions overriding virtual functions from base classes
public:
void print(const print_context & c, unsigned level = 0) const;
unsigned precedence(void) const {return 30;}
// 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__