I am not sure if this is necessary but you could add C types to hist_max, angle, b etc. and you forgot to add double to `cdef bin_size`.