#ifndef __GINAC_NUMERIC_H__
#define __GINAC_NUMERIC_H__
-#include <strstream>
#include "basic.h"
#include "ex.h"
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
// 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;
// member variables
protected:
- static unsigned precedence;
cln::cl_number value;
};
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);
// 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__