Hi sage-devel,

Using sage-5.0, it appears that (-1 % 2) gets different values if it is in 
a python file (=1), in a attached cython file (=1) or in a cython file in 
the sage tree (= -1) !

Add the following three lines to sage/combinat/partition.py :

+aaa = -1
+tmp = aaa % 2
+print "In sage/combinat/partition.py : -1 % 2 is ", tmp

Add the following three lines to sage/combinat/partitions.pyx :

+cdef int aaa = -1
+tmp = aaa % 2
+print "In sage/combinat/partitions.pyx : -1 % 2 is ", tmp

Then :

----------------------------------------------------------------------
| Sage Version 5.0, Release Date: 2012-05-14                         |
| Type notebook() for the GUI, and license() for information.        |
----------------------------------------------------------------------
In sage/combinat/partition.py : -1 % 2 is  1
In sage/combinat/partitions.pyx : -1 % 2 is  -1
sage: 

Also, if this is file.pyx :

# this is file.pyx
cdef int aaa = -1
tmp = aaa % 2
print "In attached file.pyx : -1 % 2 is ", tmp

then:

sage: attach /tmp/file.pyx
Compiling /tmp/file.pyx...
In attached file.pyx : -1 % 2 is  1

This -1 in sage library .pyx file is quite surprising to me. Is this a 
known issue?

Sébastien


-- 
-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org



Reply via email to