On May 4, 2010, at 11:05 AM, Jason Grout wrote:

On 05/04/2010 11:41 AM, William A. Stein wrote:

On May 4, 2010, at 9:06 AM, Jason Grout<jason- [email protected]> wrote:

On 05/04/2010 10:30 AM, William A. Stein wrote:

I think I wrote the original code for this, and I am ok with the change you suggest, since our policy on explicit coercions is to make them work
when they make (some) mathematical sense.

That would be great. As mentioned, I found this behavior really annoying before, and still do.


A related question is that conversion from CC or CDF to long, int, ZZ, or QQ also fails, though doing something like ZZ(RR(CC(1))) works.

Should conversion to an integer or rational try to work if the imaginary part is zero?

Yes. And note that the implementation of QQ(RR(... is pretty nontrivial.


Can I punt to that, so the tricky code is all in one place? I'm not sure how to make the coercion system convert CC to RR before converting to QQ.

Implement a _rational_ method that just returns QQ(self.real_field() (self))

- Robert

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

Reply via email to