Opened 4 years ago

Closed 4 years ago

#21186 closed defect (fixed)

Fix overflow error in conversion to PARI finite field element

Reported by: pbruin Owned by:
Priority: major Milestone: sage-7.4
Component: interfaces Keywords: pari finite field
Cc: Merged in:
Authors: Peter Bruin Reviewers: Jeroen Demeyer
Report Upstream: N/A Work issues:
Branch: a02efbb (Commits) Commit: a02efbbb6112da7d0eec4c00806186a87f035137
Dependencies: Stopgaps:

Description

From John Jones on sage-devel:

p=13189065031705623239
Fq = FiniteField(p ** 3, "a") 
Fq_X = PolynomialRing(Fq, "x")
pol=Fq_X("x^9 + 13189065031705622723*x^7 + 13189065031705622723*x^6 + 9288*x^5 + 18576*x^4 + 13189065031705590731*x^3 + 13189065031705497851*x^2 + 13189065031705497851*x + 13189065031705581443")
pol.roots()
Traceback (most recent call last):
...
OverflowError: Python int too large to convert to C long

This arises because GEN is by definition a (signed) long *. It can be fixed by adding a function set_uel(GEN x, long n, ulong z) to the PARI interface, implemented as uel(x, n) = z in C (uel is an existing PARI macro, similar to gel).

Change History (8)

comment:1 Changed 4 years ago by jdemeyer

  • Reviewers set to Jeroen Demeyer

comment:2 Changed 4 years ago by pbruin

  • Branch set to u/pbruin/21186-pari_set_uel
  • Commit set to a02efbbb6112da7d0eec4c00806186a87f035137
  • Status changed from new to needs_review

comment:3 Changed 4 years ago by jdemeyer

  • Status changed from needs_review to positive_review

comment:4 Changed 4 years ago by vbraun

Fails on OSX, Linux 32-bit

[sagelib-7.4.beta0] [141/445] gcc -fno-strict-aliasing -I/Users/buildslave-sage/slave/sage_git/build/local/var/tmp/sage/build/python2-2.7.10.p2/include -DNDEBUG -g -fwrapv -O3 -Wall -Wno-unused -I/Users/buildslave-sage/slave/sage_git/build/local/lib/python2.7/site-packages/cysignals -I/Users/buildslave-sage/slave/sage_git/build/local/include -I/Users/buildslave-sage/slave/sage_git/build/local/include/python2.7 -I/Users/buildslave-sage/slave/sage_git/build/local/lib/python2.7/site-packages/numpy/core/include -I/Users/buildslave-sage/slave/sage_git/build/src -I/Users/buildslave-sage/slave/sage_git/build/src/sage/ext -I/Users/buildslave-sage/slave/sage_git/build/src/build/cythonized -I/Users/buildslave-sage/slave/sage_git/build/src/build/cythonized/sage/ext -I/Users/buildslave-sage/slave/sage_git/build/local/include/python2.7 -c /Users/buildslave-sage/slave/sage_git/build/src/build/cythonized/sage/libs/pari/gen.c -o build/temp.macosx-10.9-x86_64-2.7/Users/buildslave-sage/slave/sage_git/build/src/build/cythonized/sage/libs/pari/gen.o -fno-strict-aliasing
[sagelib-7.4.beta0] In file included from /Users/buildslave-sage/slave/sage_git/build/src/build/cythonized/sage/libs/pari/gen.c:341:0:
[sagelib-7.4.beta0] /Users/buildslave-sage/slave/sage_git/build/local/include/pari/paripriv.h:16:48: error: unknown type name 'ulong'
[sagelib-7.4.beta0]  hashtable *hashstr_import_static(hashentry *e, ulong size);
[sagelib-7.4.beta0]                                                 ^

comment:5 Changed 4 years ago by vbraun

  • Status changed from positive_review to needs_work

comment:6 Changed 4 years ago by jdemeyer

It seems unlikely to be caused by this ticket. Are you merging any other PARI-related tickets?

comment:7 Changed 4 years ago by jdemeyer

  • Status changed from needs_work to positive_review

comment:8 Changed 4 years ago by vbraun

  • Branch changed from u/pbruin/21186-pari_set_uel to a02efbbb6112da7d0eec4c00806186a87f035137
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.