For consistency with Python's behavior for float(complex(1,0)) for
better or worse...

- William

(Sent from my iPhone.)

On Jan 28, 2008, at 5:12 PM, Robert Bradshaw <[EMAIL PROTECTED] 
 > wrote:

>
> Since the imaginary part is (indistinguishable from) 0, Is there any
> reason this succeeds:
>
> sage: RR(CDF(1))
> 1.00000000000000
> sage: RR(CC(1))
> 1.00000000000000
>
> but this fails?
>
> sage: float(CC(1))
> ------------------------------------------------------------
> Traceback (most recent call last):
>   File "<ipython console>", line 1, in <module>
>   File "complex_number.pyx", line 397, in
> sage.rings.complex_number.ComplexNumber.__float__
> <type 'exceptions.TypeError'>: can't convert complex to float; use abs
> (z)
>
> sage: float(CDF(1))
> ------------------------------------------------------------
> Traceback (most recent call last):
>   File "<ipython console>", line 1, in <module>
>   File "complex_double.pyx", line 529, in
> sage.rings.complex_double.ComplexDoubleElement.__float__
> <type 'exceptions.TypeError'>: can't convert complex to float; use abs
> (z)
>
> - Robert
>
>
> >

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to