def test_longdouble():
ffi = FFI()
ffi.cdef("long double sinl(long double x);")
lib = ffi.verify('#include <math.h>', libraries=lib_m)
for input in [1.23,
ffi.cast("double", 1.23),
ffi.cast("long double", 1.23)]:
x = lib.sinl(input)
assert repr(x).startswith("<cdata 'long double'")
assert (float(x) - math.sin(1.23)) < 1E-10
评论列表
文章目录