#8869: float(CDF(1)) should return 1.0, not throw an error
---------------------------------------------------+------------------------
   Reporter:  jason                                |       Owner:  AlexGhitza  
       Type:  defect                               |      Status:  needs_review
   Priority:  major                                |   Milestone:  sage-4.4.3  
  Component:  basic arithmetic                     |    Keywords:              
     Author:  Jason Grout                          |    Upstream:  N/A         
   Reviewer:  Karl-Dieter Crisman, Leif Leonhardy  |      Merged:              
Work_issues:                                       |  
---------------------------------------------------+------------------------

Comment(by kcrisman):

 I don't think we are trying to be contentious here.  Yes, there are
 inconsistencies, but that is just to be expected (I would even say it
 follows from Arrow's Theorem).  The point is to make it as natural to
 mathematicians as possible, and float(CDF(1)) certainly smells like 1.0 to
 me.  int is a little different, but it seems to me that since Python isn't
 consistent anyways
 {{{
 >>> int(1.1)
 1
 >>> float(1+0j)
 Traceback (most recent call last):
   File "<stdin>", line 1, in ?
 TypeError: can't convert complex to float; use abs(z)
 }}}
 we might as well make the best of it and let int be the "round closest to
 zero" function, in essence.  And it's documented, and it's not the natural
 thing one would do (Integer(1.1) behaves as you would like).

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/8869#comment:6>
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