Possbility for positive symbols/numbers.
[ginac.git] / ginac / inifcns.cpp
index c49fc7021aa5694c1862d8ff743ac9f7936b60e6..dad9d9e7702b1424300204de0acdc47c967f962b 100644 (file)
@@ -190,8 +190,14 @@ static ex abs_eval(const ex & arg)
 {
        if (is_exactly_a<numeric>(arg))
                return abs(ex_to<numeric>(arg));
 {
        if (is_exactly_a<numeric>(arg))
                return abs(ex_to<numeric>(arg));
-       else
-               return abs(arg).hold();
+
+       if (arg.info(info_flags::nonnegative))
+               return arg;
+
+       if (is_ex_the_function(arg, abs))
+               return arg;
+
+       return abs(arg).hold();
 }
 
 static void abs_print_latex(const ex & arg, const print_context & c)
 }
 
 static void abs_print_latex(const ex & arg, const print_context & c)