Hello,

I noticed the following discrepancy:

sage: ZZ(RR(3))
3
sage: RR(3) in ZZ
True
sage: ZZ(CC(3, 0))
TypeError: unable to coerce <type 'sage.rings.complex_number.ComplexNumber'>to 
an integer
sage: CC(3, 0) in ZZ
False

It's useful in some contexts to be able to recognize integer-like objects, 
and it seems that doing x in ZZ is the most convenient method. For example, 
in a symbolic function I'm implementing I have to detect singularities 
inside the _evalf_ method, which occur at negative integers for this 
particular function. However, the input is sometimes coerced into CC, and 
thus if I check whether it's in ZZ I will get false, even though it's 
integer-like.

Should I write a patch to make integer-like complex numbers coerce-able 
into ZZ?

Thank you.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to