> > Is the following the intended behaviour?
>
> > sage: type(15.mod(4))
> > <type 'sage.rings.integer.Integer'>
> > sage: type(mod(15, 4).lift())
> > <type 'sage.rings.integer.Integer'>
> > sage: 15.mod(4) == 7
> > False
> > sage: mod(15, 4).lift() == 7
> > False

Sorry, I should have said what was the intended behavior. We were
expecting mod to behave the same whether it is called as a method of a
integer or as a global function. For instance, the following functions
behave the same :

sage: 15.factor()
3 * 5
sage: factor(15)
3 * 5

sage: real(1+i)
1
sage: (1+i).real()
1

sage: type(real(1+i))
<type 'sage.symbolic.expression.Expression'>
sage: type((1+i).real())
<type 'sage.symbolic.expression.Expression'>

which is not the case for mod :

sage: type(mod(15,4))
<type 'sage.rings.integer_mod.IntegerMod_int'>
sage: type(15.mod(4))
<type 'sage.rings.integer.Integer'>

We are happy with using % if we really want the remainder as a normal
integer.

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