#8606: floats in exponent do not propagate
--------------------------------+-------------------------------------------
   Reporter:  zimmerma          |       Owner:  AlexGhitza
       Type:  defect            |      Status:  new       
   Priority:  major             |   Milestone:  sage-4.4  
  Component:  basic arithmetic  |    Keywords:  float, RR 
     Author:                    |    Upstream:  N/A       
   Reviewer:                    |      Merged:            
Work_issues:                    |  
--------------------------------+-------------------------------------------

Comment(by zimmerma):

 William, in fact {{{nn = PyNumber_Index(n)}}} raises an error, thus we go
 to
 {{{
             try:
                 nn = Integer(n)
             except TypeError:
                 try:
                     s = parent_c(n)(self)
                     return s**n
 }}}
 where {{{nn = Integer(n)}}} succeeds for n=53.0, but fails for n=53.1:
 {{{
 sage: Integer(53.0)
 53
 sage: Integer(53.1)
 ---------------------------------------------------------------------------
 TypeError                                 Traceback (most recent call
 last)

 /users/caramel/zimmerma/detached/<ipython console> in <module>()

 /usr/local/sage-core2/local/lib/python2.6/site-
 packages/sage/rings/integer.so in sage.rings.integer.Integer.__init__
 (sage/rings/integer.c:6449)()

 /usr/local/sage-core2/local/lib/python2.6/site-
 packages/sage/rings/real_mpfr.so in
 sage.rings.real_mpfr.RealNumber._integer_ (sage/rings/real_mpfr.c:11846)()

 TypeError: Attempt to coerce non-integral RealNumber to Integer
 }}}
 If {{{Integer(53.0)}}} would return an error too, this would fix the
 problem. However we would
 then need a specific method to coerce an integral real number to
 integer...

 On a side note, {{{int}}} seems to behave differently:
 {{{
 sage: int(53.0)
 53
 sage: int(53.1)
 53
 }}}

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