-
-
Notifications
You must be signed in to change notification settings - Fork 510
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
Wrong result due to integer overflow (in pynac?) #31585
Comments
comment:1
Moving to 9.4, as 9.3 has been released. |
comment:2
I reproduced the bug by installing sage in a 32-bit debian virtual machine, and found a much simpler example of the overflow:
More generally:
|
Author: Dave Morris |
comment:3
I think the problem is an incorrect calculation of absolute value:
To decide whether a multiplication might cause an overflow, pynac compares the absolute values of the factors to a certain bound. In the example of comment:2, the absolute value of a factor is negative, so it is less than the bound, even though the factor is actually very large. And I think the incorrect absolute value comes from the C++ I should be able to write a pynac patch soon that tests my theory. Even if it isn't the bug we are looking for, this bug in the absolute value needs to be fixed. |
comment:4
The same problem comes up in pynac's
|
comment:5
Here is a crash that is caused by the overflow when
Patches to fix all of these should be coming soon. |
Branch: public/31585 |
comment:7
The pynac bugs on this ticket do not currently affect 64-bit sage. (This is because pynac does not store Followup tickets: #31984 and #31986. I will try to post this (and my other pynac patches) to the pynac github repository soon. My previous attempts failed because I know almost nothing about git, but now I understand that I need a fork, instead of a clone, so I hope to be successful. New commits:
|
Commit: |
comment:8
I think this pynac patch also fixes #25688. |
comment:9
Merge conflict |
Changed branch from public/31585 to public/31585r1 |
comment:12
PR to pynac please |
comment:13
Yes, I will try. |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:15
I previously neglected to fix the I created pynac PR #378. It's my first PR to anywhere other than the trac server, so please let me know if I goofed anything up. |
comment:25
running GH Actions tests on this https://github.com/sagemath/sagetrac-mirror/actions/runs/978774922 |
comment:26
PR with standard-conforming code at pynac/pynac#379 |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:29
tests at https://github.com/sagemath/sagetrac-mirror/actions/runs/982168057 |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:31
update - https://github.com/sagemath/sagetrac-mirror/actions/runs/982441436 New commits:
|
Changed branch from u/dimpase/31585r1 to u/mkoeppe/31585r1 |
Branch pushed to git repo; I updated commit sha1. New commits:
|
Changed author from Dave Morris to Dave Morris, Matthias Koeppe |
comment:36
tests run on https://github.com/sagemath/sagetrac-mirror/actions/runs/986545913 |
comment:37
lgtm |
comment:38
Thanks! |
Changed branch from u/mkoeppe/31585r1 to |
Volker Braun pointed out in #31479 comment:12 that sage gives the following wrong answer on a 32-bit machine after the bug-fix patch of #31479 is applied:
This answer is congruent modulo
2^32
tod^3 + 18*d^2 + 93*d - 465/d + 450/d^2 - 125/d^3 + 36
, which is the correct answer, so it seems clear that the problem comes from an integer overflow error. Perhaps the overflow error can also be produced on a 64-bit machine.Depends on #31694
Component: symbolics
Keywords: integer overflow, pynac
Author: Dave Morris, Matthias Koeppe
Branch/Commit:
eba0a9c
Reviewer: Dima Pasechnik
Issue created by migration from https://trac.sagemath.org/ticket/31585
The text was updated successfully, but these errors were encountered: