#8299: coercion and the bool type
------------------------------+---------------------------------------------
   Reporter:  robertwb        |       Owner:  robertwb       
       Type:  defect          |      Status:  positive_review
   Priority:  minor           |   Milestone:  sage-4.3.4     
  Component:  coercion        |    Keywords:                 
     Author:                  |    Upstream:  N/A            
   Reviewer:  Ross Kyprianou  |      Merged:                 
Work_issues:                  |  
------------------------------+---------------------------------------------
Changes (by rossk):

  * status:  needs_review => positive_review
  * reviewer:  => Ross Kyprianou


Comment:

 All good Robert. This patch treats True as 1, False as 0 for arithmetic
 with non-complex types.
 {{{
 sage: [k+True for k in (3, 3r, 3.0, 3.0r, 1/3, 3*I+5)]
 [4, 4, 4.00000000000000, 4.0, 4/3, 2]

 sage: [k+False for k in (3, 3r, 3.0, 3.0r, 1/3, 3*I+5)]
 [3, 3, 3.00000000000000, 3.0, 1/3, 1]

 sage: [k*True for k in (3, 3r, 3.0, 3.0r, 1/3, 3*I+5)]
 [3, 3, 3.00000000000000, 3.0, 1/3, 1]

 sage: [k*False for k in (3, 3r, 3.0, 3.0r, 1/3, 3*I+5)]
 [0, 0, 0.000000000000000, 0.0, 0, 0]
 }}}

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