#8869: float(CDF(1)) should return 1.0, not throw an error
--------------------------------+-------------------------------------------
   Reporter:  jason             |       Owner:  AlexGhitza
       Type:  defect            |      Status:  new       
   Priority:  major             |   Milestone:  sage-4.4.1
  Component:  basic arithmetic  |    Keywords:            
     Author:                    |    Upstream:  N/A       
   Reviewer:                    |      Merged:            
Work_issues:                    |  
--------------------------------+-------------------------------------------
 Right now, we have the following behavior:

 {{{
 sage: float(CC(1.0))
 1.0


 sage: float(CDF(1.0))
 ---------------------------------------------------------------------------
 TypeError                                 Traceback (most recent call
 last)

 /home/jason/<ipython console> in <module>()

 /home/jason/sage/local/lib/python2.6/site-
 packages/sage/rings/complex_double.so in
 sage.rings.complex_double.ComplexDoubleElement.__float__
 (sage/rings/complex_double.c:6532)()

 TypeError: can't convert complex to float; use abs(z)


 sage: float(complex(1.0))
 ---------------------------------------------------------------------------
 TypeError                                 Traceback (most recent call
 last)

 /home/jason/<ipython console> in <module>()

 TypeError: can't convert complex to float
 }}}

 As robertwb and was voted (on
 http://trac.sagemath.org/sage_trac/ticket/5400#comment:12 and on sage-
 devel), we should make float conversion succeed if the imaginary part is
 zero.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/8869>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to