Opened 13 years ago

Closed 13 years ago

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

Reported by: Owned by: was somebody blocker sage-4.1.2 basic arithmetic wbhart, burcin Sage 4.1.2.alpha4 Mike Hansen, William Stein John Palmieri, Minh Van Nguyen

### 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
```

}}}

### comment:1 Changed 13 years ago by burcin

• Cc wbhart burcin added

### comment:2 Changed 13 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.
```

### comment:3 Changed 13 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 13 years ago by was

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

It's based exactly on mhansen's spkg.

### comment:5 Changed 13 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 13 years ago by mvngu

New FLINT package up at

The only change from .p1 is:

• Check in all changes in wstein's name.

### comment:7 Changed 13 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 13 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 13 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.