#11779: python ints vs sage ints with respect to powers weirdness
------------------------+---------------------------------------------------
   Reporter:  dimpase   |          Owner:  AlexGhitza       
       Type:  defect    |         Status:  needs_review     
   Priority:  major     |      Milestone:  sage-4.7.2       
  Component:  coercion  |       Keywords:                   
Work_issues:            |       Upstream:  N/A              
   Reviewer:            |         Author:  Dmitrii Pasechnik
     Merged:            |   Dependencies:                   
------------------------+---------------------------------------------------

Comment(by klee):

 I agree with leif. I think any in "int(3)^any" should be converted to an
 integer n (or -n), and then int(3)^any equals int(3) multiplied n times
 with itself (or numerical inverse of int(3) multiplied n times with
 itself). Thus int(3)^any is of type float always. If any cannot be
 converted to an integer, then an exception should be raised.

 Thus int(3)^3, int(3)^QQ(3), int(3)^ZZ(3), int(3)^CC(3) all results in
 Pythonic integer 27. int(3)^-3, int(3)^QQ(-3), int(3)^ZZ(-3),
 int(3)^CC(-3) all results in Pythonic float 0.037037037037037028.

 By the way, I think there is nothing wrong with this
 {{{
 sage: p(x)=x^-3
 sage: p(int(3))
 1/27
 }}}
 because int(3) is converted to a Sage expression first. See
 {{{
 sage: q(x)=x
 sage: type(q(int(3)))
 <type 'sage.symbolic.expression.Expression'>
 }}}

 So I think this ticket and the patch is misdirected.

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