@cython.cdivision(True) causes "math domain error" in weird scenario

Running a Jupyter notebook in VSCode, I am getting bizarre behavior with the Cython unprotected division directive. Starting the session with %load_ext cython, run: %%cython import math cimport cython @cython.cdivision(True) def simpleTest(int d): cdef double c = 1/math.exp(math.log(math.sqrt(2/d))) return c Now run simpleTest(x) and for any value of x >= 3 I get: ValueError: math… Read More @cython.cdivision(True) causes "math domain error" in weird scenario

Is there a limit to how large an array can be inside of a function in cython?

This code compiles and runs just fine: cdef enum: SIZE = 1000000 cdef int ar[SIZE] cdef int i for i in range(SIZE): ar[i] = i print(ar[5]) but this code: cdef enum: SIZE = 1000000 def test(): cdef int ar[SIZE] cdef int i for i in range(SIZE): ar[i] = i print(ar[5]) test() crashes the python kernel… Read More Is there a limit to how large an array can be inside of a function in cython?