diff options
author | Lisandro Dalcin <dalcinl@gmail.com> | 2014-11-21 14:40:27 +0300 |
---|---|---|
committer | Lisandro Dalcin <dalcinl@gmail.com> | 2014-11-21 14:40:27 +0300 |
commit | 09f7a4408f8fec688142e2f3d5d8f08b7f3923dd (patch) | |
tree | 007b08b8bd5977f74d16a6592b268a6e983946d7 | |
parent | 4ed5c3fc74652d750f359fccb23aa7d98f1181b4 (diff) | |
download | cffi-09f7a4408f8fec688142e2f3d5d8f08b7f3923dd.tar.gz |
Fix test for approximate floating point return type
-rw-r--r-- | testing/test_verify.py | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/testing/test_verify.py b/testing/test_verify.py index 2d34d98..1a2d18a 100644 --- a/testing/test_verify.py +++ b/testing/test_verify.py @@ -91,13 +91,9 @@ def test_simple_case(): def test_rounding_1(): ffi = FFI() - ffi.cdef("float sin(double x);") - lib = ffi.verify(''' - #include <math.h> - static float my_sin(double x) { return (float)sin(x); } - #define sin my_sin - ''', libraries=lib_m) - res = lib.sin(1.23) + ffi.cdef("double sinf(float x);") + lib = ffi.verify('#include <math.h>', libraries=lib_m) + res = lib.sinf(1.23) assert res != math.sin(1.23) # not exact, because of double->float assert abs(res - math.sin(1.23)) < 1E-5 |