[pypy-commit] cffi default: "long double" might be the same as "double", e.g. with VC2008.

arigo noreply at buildbot.pypy.org
Thu Sep 13 15:20:14 CEST 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r930:43e3c5b9fee7
Date: 2012-09-13 15:20 +0200
http://bitbucket.org/cffi/cffi/changeset/43e3c5b9fee7/

Log:	"long double" might be the same as "double", e.g. with VC2008.

diff --git a/testing/test_verify.py b/testing/test_verify.py
--- a/testing/test_verify.py
+++ b/testing/test_verify.py
@@ -106,6 +106,7 @@
     # passing through Python and CFFI.
     ffi = FFI()
     ffi.cdef("long double step1(long double x);")
+    SAME_SIZE = ffi.sizeof("long double") == ffi.sizeof("double")
     lib = ffi.verify("""
         long double step1(long double x)
         {
@@ -122,16 +123,18 @@
 
     more_precise = do(False)
     less_precise = do(True)
-    assert abs(more_precise - less_precise) > 0.1
-
-    # Check the particular results on Intel
-    import platform
-    if (platform.machine().startswith('i386') or
-        platform.machine().startswith('x86')):
-        assert abs(more_precise - 0.656769) < 0.001
-        assert abs(less_precise - 3.99091) < 0.001
+    if SAME_SIZE:
+        assert more_precise == less_precise
     else:
-        py.test.skip("don't know the very exact precision of 'long double'")
+        assert abs(more_precise - less_precise) > 0.1
+        # Check the particular results on Intel
+        import platform
+        if (platform.machine().startswith('i386') or
+            platform.machine().startswith('x86')):
+            assert abs(more_precise - 0.656769) < 0.001
+            assert abs(less_precise - 3.99091) < 0.001
+        else:
+            py.test.skip("don't know the very exact precision of 'long double'")
 
 
 all_integer_types = ['short', 'int', 'long', 'long long',


More information about the pypy-commit mailing list