#11856: Raise an overflow error if the exponent of a multivariate polynomial
flows
over
-----------------------------------+----------------------------------------
Reporter: SimonKing | Owner: malb
Type: defect | Status: new
Priority: critical | Milestone: sage-4.7.2
Component: commutative algebra | Keywords: exponent overflow
Work_issues: | Upstream: N/A
Reviewer: | Author:
Merged: | Dependencies:
-----------------------------------+----------------------------------------
The following happens at least since sage-4.6.2 and was detected in #4539
by a new doctest:
{{{
sage: P.<x,y> = QQ[]
sage: y^2^30
y^1073741824
sage: P.<x,y,z> = QQ[]
sage: y^2^30
0
}}}
According to Hans, the maximal exponent of a variable in a monomial does
depend on the number of variables in the ring. There is no function that
returns that maximal exponent, but it is stored in the `bitmask` attribute
of a ring. The Singular interpreter actually only tests whether the
''total'' degree is below what is provided by bitmask; in theory, ''any''
exponent (not only the totall degree) can go up to that bound.
Here is the corresponding code in Singular's `iparith.cc`:
{{{
static BOOLEAN jjTIMES_P(leftv res, leftv u, leftv v)
{
poly a;
poly b;
int dummy;
if (v->next==NULL)
{
a=(poly)u->CopyD(POLY_CMD); // works also for VECTOR_CMD
if (u->next==NULL)
{
b=(poly)v->CopyD(POLY_CMD); // works also for VECTOR_CMD
if ((a!=NULL) && (b!=NULL)
&&
(pTotaldegree(a)+pTotaldegree(b)>si_max((long)rVar(currRing),(long)currRing->bitmask)))
{
Werror("OVERFLOW in mult(d=%ld, d=%ld, max=%ld)",
pTotaldegree(a),pTotaldegree(b),currRing->bitmask);
pDelete(&a);
pDelete(&b);
return TRUE;
...
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11856>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.