#16025: Calling the .n() method on reals shouldn't increase precision
----------------------------------+------------------------
       Reporter:  rws             |        Owner:
           Type:  defect          |       Status:  new
       Priority:  major           |    Milestone:  sage-6.4
      Component:  calculus        |   Resolution:
       Keywords:                  |    Merged in:
        Authors:  Jeroen Demeyer  |    Reviewers:
Report Upstream:  N/A             |  Work issues:
         Branch:                  |       Commit:
   Dependencies:                  |     Stopgaps:
----------------------------------+------------------------
Changes (by {'newvalue': u'Jeroen Demeyer', 'oldvalue': ''}):

 * author:   => Jeroen Demeyer


Old description:

> {{{
> sage: Ei(1.1).n(300)
> 2.16737827956340289858871983597055077552795410156250000000000000000000000000000000000000000
>
> sage: Ei(RealField(300)(1.1))
> 2.16737827956340282358378734233807621497112737591639704719499002090327541763352339357795426
>
> sage: Ei(11/10).n(300)
> 2.16737827956340282358378734233807621497112737591639704719499002090327541763352339357795426
>
> sage: Ei(1.1,prec=300)
> /home/ralf/sage/src/bin/sage-ipython:1: DeprecationWarning: The prec
> keyword argument is deprecated. Explicitly set the precision of the
> input, for example Ei(RealField(300)(1)), or use the prec argument to
> .n() for exact inputs, e.g., Ei(1).n(300), instead.
> See http://trac.sagemath.org/7748 for details.
>   #!/usr/bin/env python
> 2.16737827956340306615064476647912607220394065907142504328679588538509331805598360907980986
> }}}
> Not sure what would be correct, though.

New description:

 The `.n()` is dangerous, as it can give easily give false precision:
 {{{
 sage: Ei(1.1).n(300)
 
2.16737827956340289858871983597055077552795410156250000000000000000000000000000000000000000

 sage: Ei(RealField(300)(1.1))
 
2.16737827956340282358378734233807621497112737591639704719499002090327541763352339357795426

 sage: Ei(11/10).n(300)
 
2.16737827956340282358378734233807621497112737591639704719499002090327541763352339357795426
 0394065907142504328679588538509331805598360907980986
 }}}

 The fact that several doctests in the Sage library have this error shows
 that this error is easily made.

--

--
Ticket URL: <http://trac.sagemath.org/ticket/16025#comment:8>
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to