import sys, numpy, cython
sys.version, cython.__version__
('3.9.2 (default, Feb 28 2021, 17:03:44) \n[GCC 10.2.1 20210110]', '0.29.33')
%load_ext Cython
%%cython
from cython cimport floating
def add(floating a, floating b):
return a+b
#excepted to fail
add(5,8)
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) /tmp/ipykernel_1528278/3700531371.py in <module> 1 #excepted to fail ----> 2 add(5,8) _cython_magic_783229ae9776e63b1958582700c7e75c.pyx in _cython_magic_783229ae9776e63b1958582700c7e75c.__pyx_fused_cpdef() TypeError: No matching signature found
#excepted to work
add(5.0,8.0)
13.0
#excepted to work
add(numpy.float32(5.0),numpy.float32(8.0))
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) /tmp/ipykernel_1528278/979507066.py in <module> 1 #excepted to work ----> 2 add(numpy.float32(5.0),numpy.float32(8.0)) _cython_magic_783229ae9776e63b1958582700c7e75c.pyx in _cython_magic_783229ae9776e63b1958582700c7e75c.__pyx_fused_cpdef() TypeError: No matching signature found
#excepted to work
add(numpy.float64(5.0),numpy.float64(8.0))
13.0
#excepted to fail
add(numpy.float64(5.0), numpy.float32(8.0))
13.0