git://www.ginac.de
/
ginac.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0f7f5c0
)
Improve abs(arg).
author
Vladimir Kisil
<kisilv@maths.leeds.ac.uk>
Wed, 22 Apr 2015 21:21:53 +0000
(23:21 +0200)
committer
Richard Kreckel
<kreckel@ginac.de>
Wed, 22 Apr 2015 21:21:53 +0000
(23:21 +0200)
Make abs(arg) return -arg if arg is negative or if -arg is known to be
nonnegative.
ginac/inifcns.cpp
patch
|
blob
|
history
diff --git
a/ginac/inifcns.cpp
b/ginac/inifcns.cpp
index 28d54fed3e79924dffbd95c457add5ff2bbd662a..ecb6e0072fb8333067ab5c54ba8d7453c0dacc97 100644
(file)
--- a/
ginac/inifcns.cpp
+++ b/
ginac/inifcns.cpp
@@
-273,6
+273,9
@@
static ex abs_eval(const ex & arg)
if (arg.info(info_flags::nonnegative))
return arg;
+ if (arg.info(info_flags::negative) || (-arg).info(info_flags::nonnegative))
+ return -arg;
+
if (is_ex_the_function(arg, abs))
return arg;