Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#6919 closed defect (fixed)

[with patch and spkg, positive review] basic arithmetic using FLINT is broken (very serious!)

Reported by: was Owned by: somebody
Priority: blocker Milestone: sage-4.1.2
Component: basic arithmetic Keywords:
Cc: wbhart, burcin Merged in: Sage 4.1.2.alpha4
Authors: Mike Hansen, William Stein Reviewers: John Palmieri, Minh Van Nguyen
Report Upstream: Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description

Mariah Lenox reported:

R.<x> = PolynomialRing(ZZ)
A = 2^(2^17+2^15)  # note the 2 rather than the "s"
a = A * x^31
b = (A * x) * x^30
a == b   # prints "False" ???

But

R.<x> = PolynomialRing(ZZ, implementation='NTL')
A = 2^(2^17+2^15)  # note the 2 rather than the "s"
a = A * (x^31)
b = A * x * (x^30)
a == b   

gives True. So this is definitely either a bug in FLINT (highly likely), or a bug in our wrapper (much less likely, since our wrapper is so generic:

cpdef RingElement _mul_(self, RingElement right):
    r"""
    Returns self multiplied by right.

    EXAMPLES::

        sage: R.<x> = PolynomialRing(ZZ)
        sage: (x - 2)*(x^2 - 8*x + 16)
        x^3 - 10*x^2 + 32*x - 32
    """
    cdef Polynomial_integer_dense_flint x = self._new()
    _sig_on
    fmpz_poly_mul(x.__poly, self.__poly,
            (<Polynomial_integer_dense_flint>right).__poly)
    _sig_off
    return x

}}}

Attachments (1)

trac_6919.patch (688 bytes) - added by mhansen 8 years ago.

Download all attachments as: .zip

Change History (10)

comment:1 Changed 8 years ago by burcin

  • Cc wbhart burcin added

comment:2 Changed 8 years ago by burcin

Bill Hart <goodwillhart@googlemail.com> wrote:
<snip>
> It was caused by a bug in the FLINT FFT (the first ever found). I
> tracked the bug down to a specific piece of code and David Harvey has
> supplied a fix. There will be a new version of FLINT to patch this
> bug.

Changed 8 years ago by mhansen

comment:3 Changed 8 years ago by mhansen

  • Authors set to Mike Hansen
  • Summary changed from basic arithmetic using FLINT is broken (very serious!) to [with patch and spkg, needs review] basic arithmetic using FLINT is broken (very serious!)

I've attached a patch which makes sure that this bug is indeed fixed by FLINT 1.5.0. The spkg can be found at http://sage.math.washington.edu/home/mhansen/flint-1.5.0.p0.spkg . This spkg is based of 1.3.0.p3 that Ondrej did.

comment:4 Changed 8 years ago by was

I posted another spkg that adds one critical Cygwin fix, namely naming the library libflint.dll instead of libflint.so:

http://sage.math.washington.edu/home/wstein/patches/flint-1.5.0.p1.spkg

It's based exactly on mhansen's spkg.

comment:5 Changed 8 years ago by jhpalmieri

OS X 10.5, both 32-bit and 64-bit: first I applied the patch. This produced the doctest failure described in the ticket for the file libs/flint/flint.pyx. Then I did 'sage -f flint...' to install the new spkg . Then this file passed doctests.

comment:6 Changed 8 years ago by mvngu

New FLINT package up at

http://sage.math.washington.edu/home/mvngu/release/spkg/standard/flint-1.5.0.p2.spkg

The only change from .p1 is:

  • Check in all changes in wstein's name.

comment:7 Changed 8 years ago by mvngu

  • Authors changed from Mike Hansen to Mike Hansen, William Stein
  • Merged in set to Sage 4.1.2.alpha3
  • Resolution set to fixed
  • Reviewers set to John Palmieri, Minh Van Nguyen
  • Status changed from new to closed

See palmieri's and my reports at #6849.

comment:8 Changed 8 years ago by mvngu

  • Summary changed from [with patch and spkg, needs review] basic arithmetic using FLINT is broken (very serious!) to [with patch and spkg, positive review] basic arithmetic using FLINT is broken (very serious!)

comment:9 Changed 8 years ago by mvngu

  • Merged in changed from Sage 4.1.2.alpha3 to Sage 4.1.2.alpha4

There is no 4.1.2.alpha3. Sage 4.1.2.alpha3 was William Stein's release for working on making the notebook a standalone package.

Note: See TracTickets for help on using tickets.