#10952: better numerical accuracy testing
---------------------------+------------------------------------------------
   Reporter:  robertwb     |          Owner:  mvngu          
       Type:  enhancement  |         Status:  needs_review   
   Priority:  major        |      Milestone:                 
  Component:  doctest      |       Keywords:                 
Work_issues:               |       Upstream:  N/A            
   Reviewer:  Jason Grout  |         Author:  Robert Bradshaw
     Merged:               |   Dependencies:                 
---------------------------+------------------------------------------------
Changes (by robertwb):

  * status:  needs_work => needs_review


Old description:

> {{{
> sage: print "The answers are", 1.5, 2, 1e-12 # tol 1e-3
> The answers are 1.499999 2.0001 0
> }}}

New description:

 If a line contains ``tol`` or ``tolerance, numerical results are only
 verified to the given tolerance. This may be prefixed by ``abs[olute``
 or ``rel[ative]`` to specify whether to measure absolute or relative
 error; defaults to relative error except when the expected value is
 exactly zero:

 {{{
         sage: RDF(pi)                               # abs tol 1e-5
         3.14159
         sage: [10^n for n in [0.0 .. 4]]            # rel tol 2e-4
         [0.9999, 10.001, 100.01, 999.9, 10001]
 }}}

 This can be useful when the exact output is subject to rounding error
 and/or processor floating point arithmetic variation.

--

Comment:

 True. It doesn't work with print (or other non-expression statements).
 I've created #11336 to generalize it.

 I think that this is still plenty useful even with that limitation, and
 don't know when I'll have more time to work on it--we could either get
 this in and start using it now or hold off until has time to write a more
 complete implementation at some later date (which I'd like to get to
 someday, but that someday list is long...)

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