-
-
Notifications
You must be signed in to change notification settings - Fork 559
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
abs(pi+I) = pi+I #11155
Comments
comment:1
In the future, be sure to pick a component (for instance, calculus or symbolics); that will help people find it more easily. Thanks for the bug report; mathematically incorrect is definitely bad! I can confirm this. Moving to major. Note the following.
Pynac is somehow missing this. Note that it gets e right.
|
This comment has been minimized.
This comment has been minimized.
comment:2
I can confirm this further. It's mathematically seriously incorrect... so now moving from major to critical, and cc'ing burcin. Note:
|
comment:3
Reported to the ginac-devel list: http://thread.gmane.org/gmane.comp.mathematics.ginac.devel/1363 More detailed about the problem are in my message linked above. |
comment:4
Apparently already fixed! |
comment:5
Here is the diff. diff --git a/check/exam_numeric.cpp b/check/exam_numeric.cpp
index 715acff..d5ae27b 100644 (file)
--- a/check/exam_numeric.cpp
+++ b/check/exam_numeric.cpp
@@ -68,6 +68,11 @@ static unsigned exam_numeric1()
<< " erroneously not recognized as complex rational" << endl;
++result;
}
+ if (test_crat.info(info_flags::nonnegative)) {
+ clog << test_crat
+ << " erroneously recognized as non-negative number" << endl;
+ ++result;
+ }
int i = numeric(1984).to_int();
if (i-1984) {
diff --git a/ginac/numeric.cpp b/ginac/numeric.cpp
index f05763d..18725b2 100644 (file)
--- a/ginac/numeric.cpp
+++ b/ginac/numeric.cpp
@@ -700,7 +700,7 @@ bool numeric::info(unsigned inf) const
case info_flags::negative:
return is_negative();
case info_flags::nonnegative:
- return !is_negative();
+ return is_zero() || is_positive();
case info_flags::posint:
return is_pos_integer();
case info_flags::negint: |
comment:6
Making this change in Pynac does fix it:
So now we just need to package this up. See #12501 for the most recently merged Pynac. |
comment:7
Attachment: trac_11155-doctest.patch.gz Pull request of the patch to the main repository https://bitbucket.org/burcin/pynac/pull-request/1/bugfix-numeric-info-nonnegative-correctly |
comment:8
Pynac 0.2.4 available in #12950 contains the upstream fix. This ticket can be closed once that is merged. |
Reviewer: Burcin Erocal |
Author: Alexei Sheplyakov, Titus Nicolae |
This comment has been minimized.
This comment has been minimized.
Dependencies: #12950 |
Merged: sage-5.1.beta4 |
abs(pi+I) returns pi+I
one would have expected:
Apply attachment: trac_11155-doctest.patch
Depends on #12950
CC: @burcin
Component: symbolics
Author: Alexei Sheplyakov, Titus Nicolae
Reviewer: Burcin Erocal
Merged: sage-5.1.beta4
Issue created by migration from https://trac.sagemath.org/ticket/11155
The text was updated successfully, but these errors were encountered: