]> rtime.felk.cvut.cz Git - coffee/buildroot.git/commitdiff
python: fix double format detection
authorJérôme Pouiller <jezz@sysmic.org>
Wed, 9 Nov 2016 09:25:07 +0000 (10:25 +0100)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Wed, 9 Nov 2016 20:57:18 +0000 (21:57 +0100)
Python is not able to detect if compiler double representation is
compliant with IEE754:

  checking whether C doubles are little-endian IEEE 754 binary64... no
  checking whether C doubles are big-endian IEEE 754 binary64... no
  checking whether C doubles are ARM mixed-endian IEEE 754 binary64... no

Accordingly 'legacy' mode isused. It is possible to check this at
runtime by check if 'sys.float_repr_style' contains 'short' or
'legacy'. Calculus correctness is not garanteed with 'legacy'.

Problem is better described here:

  http://stackoverflow.com/questions/29920294/what-causes-pythons-float-repr-style-to-use-legacy
  https://bugs.python.org/issue7117

However, all gcc architecture use a representation compliant with
IEE754. So, we can enable it unconditionnaly.

Signed-off-by: Jérôme Pouiller <jezz@sysmic.org>
[Thomas: adjust condition to avoid usage of qstrip, suggested by Baruch.]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
package/python/python.mk

index cc6537683740a30e0a94cef919ac9ec583590b73..cfd5a0af12ffb8d62bf308a950cf35056e349c98 100644 (file)
@@ -140,6 +140,13 @@ PYTHON_CONF_ENV += \
        ac_cv_prog_HAS_HG=/bin/false \
        ac_cv_prog_SVNVERSION=/bin/false
 
+# GCC is always compliant with IEEE754
+ifeq ($(BR2_ENDIAN),"LITTLE")
+PYTHON_CONF_ENV += ac_cv_little_endian_double=yes
+else
+PYTHON_CONF_ENV += ac_cv_big_endian_double=yes
+endif
+
 PYTHON_CONF_OPTS += \
        --without-cxx-main      \
        --without-doc-strings   \