You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This means that if an integer value could fit into a C++ signed integer, then it will be stored as a signed long integer; otherwise, it will be stored as an mpz value. This is a waste of bits: a signed long integer can usually hold much larger values than a signed integer. Therefore, in order to use all of the bits of the signed long integer variable, this patch changes mpz_fits_sint_p to mpz_fits_slong_p.
This change may uncover bugs in the pynac code. For example, the bugs of #31585 were previously only seen on 32-bit, but they show up in 64-bit (after changing 2^31 to 2^63) if the patch here is applied without patches that solve the problems on that ticket:
sage: n = 2^63
sage: (2*x).subs(x=-n)
0
sage: abs(x).subs(x=-n)
-9223372036854775808
sage: (-x).subs(x=-n)
-9223372036854775808
sage: a,b,c,d = var("a b c d")
sage: ((a + b + c)^62 * (3*b + d - 5/d)^3).expand().subs(a=0,b=2,c=-1)
d^3 + 18*d^2 + 15439924789694894702685*d - 77199623948474473513425/d + 450/d^2 - 125/d^3 + 36
sage: (-n*x + 1)*x
------------------------------------------------------------------------
(no backtrace available)
------------------------------------------------------------------------
Unhandled SIGFPE: An unhandled floating point exception occurred.
This probably occurred because a *compiled* module has a bug
in it and is not properly wrapped with sig_on(), sig_off().
Python will now terminate.
It therefore seems that this ticket should be merged early in a release cycle, so I am suggesting 9.5 as the milestone.
Pynac's numeric.cpp file includes the following function definition:
This means that if an integer value could fit into a C++
signed integer
, then it will be stored as asigned long integer
; otherwise, it will be stored as anmpz
value. This is a waste of bits: asigned long integer
can usually hold much larger values than asigned integer
. Therefore, in order to use all of the bits of thesigned long integer
variable, this patch changesmpz_fits_sint_p
tompz_fits_slong_p
.This change may uncover bugs in the pynac code. For example, the bugs of #31585 were previously only seen on 32-bit, but they show up in 64-bit (after changing
2^31
to2^63
) if the patch here is applied without patches that solve the problems on that ticket:It therefore seems that this ticket should be merged early in a release cycle, so I am suggesting 9.5 as the milestone.
Depends on #31585
Depends on #31984
Component: symbolics
Keywords: pynac, long
Branch/Commit: public/31986 @
5e08324
Issue created by migration from https://trac.sagemath.org/ticket/31986
The text was updated successfully, but these errors were encountered: