+#include "inifcns.h"
+#include "ex.h"
+#include "constant.h"
+#include "lst.h"
+#include "matrix.h"
+#include "mul.h"
+#include "ncmul.h"
+#include "numeric.h"
+#include "power.h"
+#include "relational.h"
+#include "pseries.h"
+#include "symbol.h"
+#include "utils.h"
+
+#ifndef NO_NAMESPACE_GINAC
+namespace GiNaC {
+#endif // ndef NO_NAMESPACE_GINAC
+
+//////////
+// absolute value
+//////////
+
+static ex abs_evalf(const ex & x)
+{
+ BEGIN_TYPECHECK
+ TYPECHECK(x,numeric)
+ END_TYPECHECK(abs(x))
+
+ return abs(ex_to_numeric(x));
+}
+
+static ex abs_eval(const ex & x)
+{
+ if (is_ex_exactly_of_type(x, numeric))
+ return abs(ex_to_numeric(x));
+ else
+ return abs(x).hold();
+}
+
+REGISTER_FUNCTION(abs, evalf_func(abs_eval).
+ evalf_func(abs_evalf));