#9953: int(symbolic expr) off by 1
-------------------------+--------------------------------------------------
   Reporter:  schilly    |       Owner:  burcin  
       Type:  defect     |      Status:  new     
   Priority:  critical   |   Milestone:  sage-4.6
  Component:  symbolics  |    Keywords:          
     Author:             |    Upstream:  N/A     
   Reviewer:             |      Merged:          
Work_issues:             |  
-------------------------+--------------------------------------------------
 Problem, last digit is either 6 or 7. In short:

 {{{
 fermat(n) = 2**2**n + 1
 fermat(9) gives ....4097 but:
 int(fermat(9)) gives ...4096L.
 Same with: long(fermat(9)).
 int(2**2**9 +1) gives ...4097L
 }}}

 Burcin says: int(x) for a symbolic expression x just calls
 int(x.n(prec=100)). We lose that 1 in the approximation.

 full example in 4.5.2:

 {{{
 sage: fermat(n) = 2**2**n + 1
 sage: fermat(9)
 134078079299425970995740249982058461274793658205923933777\
 235614437217640300735469768018742981669034276900318581864\
 86050853753882811946569946433649006084097
 sage: int(fermat(9))
 134078079299425970995740249982058461274793658205923933777\
 235614437217640300735469768018742981669034276900318581864\
 86050853753882811946569946433649006084096L
 sage: long(fermat(9))
 134078079299425970995740249982058461274793658205923933777\
 235614437217640300735469768018742981669034276900318581864\
 86050853753882811946569946433649006084096L
 sage: int(2**2**9 +1)
 134078079299425970995740249982058461274793658205923933777\
 235614437217640300735469768018742981669034276900318581864\
 86050853753882811946569946433649006084097L
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/9953>
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