import sys, numpy, cython
sys.version, cython.__version__
('3.11.0 | packaged by conda-forge | (main, Jan 14 2023, 12:27:40) [GCC 11.3.0]', '3.0.0b1')
%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) Cell In[5], line 2 1 #excepted to fail ----> 2 add(5,8) File _cython_magic_8341fdc07d86af7a4a3dc24a69e8a647e13f19cf.pyx:3, in _cython_magic_8341fdc07d86af7a4a3dc24a69e8a647e13f19cf.__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) Cell In[7], line 2 1 #excepted to work ----> 2 add(numpy.float32(5.0),numpy.float32(8.0)) File _cython_magic_8341fdc07d86af7a4a3dc24a69e8a647e13f19cf.pyx:3, in _cython_magic_8341fdc07d86af7a4a3dc24a69e8a647e13f19cf.__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