fplll / fpylll

A Python interface for https://github.com/fplll/fplll
GNU General Public License v2.0
118 stars 60 forks source link

Long Double causing test failures on aarch64-darwin #269

Closed Feyorsh closed 5 months ago

Feyorsh commented 5 months ago

I'd like to preface this by stressing that I am not an experienced user of fplll, but merely a package maintainer; please push back on the assumptions I make if they are incorrect.

Erroneous behaviour

When attempting to build 0.6.1, I get the following test failures:

=================================== FAILURES ===================================
______________________________ [doctest] util.pyx ______________________________
146     :param float_type: one of 'double', 'long double', 'dpe', 'dd', 'qd' or 'mpfr'
147     :returns: precision in bits
148 
149     This function returns the precision per type::
150 
151         >>> import fpylll
152         >>> from fpylll import FPLLL
153         >>> FPLLL.get_precision('double')
154         53
155         >>> if fpylll.config.have_long_double:
Expected:
    True
Got:
    False

/private/tmp/nix-build-python3.11-fpylll-0.6.1.drv-0/source/src/fpylll/util.pyx:155: DocTestFailure
______________________________ [doctest] gso.pyx _______________________________
562 
563     @property
564     def float_type(self):
565         """
566         >>> from fpylll import IntegerMatrix, GSO, FPLLL
567         >>> A = IntegerMatrix(10, 10)
568         >>> M = GSO.Mat(A)
569         >>> M.float_type
570         'double'
571         >>> FPLLL.set_precision(100)
Expected:
    53
Got:
    100

The fix

I am fairly sure, though not certain, that aarch64-darwin does not have hardware support for 128-bit floating point (long doubles). Cygwin faces the same issue, so adding checks for aarch64-darwin to setup.py and to the corresponding fplll source should fix the issue. Note that this issue also ought to affect fplll.