I'm using "Cython version 0.13", included with Sage. There is (in
my opinion) a bug in the cdivision=False implementation. With the
"cdivision=False" command line option, the following two lines do
completely different things:
n = n % k
versus
n %= k
Here's a Sage notebook session illustrating exactly this:
{{{id=8|
%cython
def f():
cdef int n = -7, k = 11
n = n % k
print n
///
}}}
{{{id=7|
f()
///
4
}}}
{{{id=9|
%cython
def f():
cdef int n = -7, k = 11
n %= k
print n
///
}}}
{{{id=10|
f()
///
-7
}}}
The Sage library is build with cdivision=True, but the %cython mode in
the notebook using cdivision=False.
--
William Stein
Professor of Mathematics
University of Washington
http://wstein.org
Yep, that's a bug.
http://trac.cython.org/cython_trac/ticket/591
- Robert