[Cython] Semantics of cdef int division and %?

Stefan Behnel stefan_ml at behnel.de
Mon Mar 16 19:13:24 CET 2009


Sturla Molden wrote:
>> It seems like the only places where this matters are with integers.
> 
> 0.0/0.0 gives a NAN in C and raises an exception in Python.

On the Python side, this has little to do with typing, as the same applies
to integers. On the C side, typing will give you the required semantics
now, no change required.


>> As for floats, just alias py_float with double.
> 
> So a cdef int s a py_int, but a cdef float is not a py_float?

No, that's not what he wrote, and it's not how things work either. Maybe
you should try to understand the existing semantics first, before taking
the step to proposing improvements.

Stefan


More information about the Cython-dev mailing list