Changes between Version 1 and Version 16 of Ticket #10952


Ignore:
Timestamp:
05/16/11 19:38:54 (9 years ago)
Author:
robertwb
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...)

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #10952

    • Property Cc kcrisman added
    • Property Authors changed from to Robert Bradshaw
    • Property Reviewers changed from to Jason Grout
  • Ticket #10952 – Description

    v1 v16  
     1If a line contains ``tol`` or ``tolerance, numerical results are only
     2verified to the given tolerance. This may be prefixed by ``abs[olute``
     3or ``rel[ative]`` to specify whether to measure absolute or relative
     4error; defaults to relative error except when the expected value is
     5exactly zero:
     6
    17{{{
    2 sage: print "The answers are", 1.5, 2, 1e-12 # tol 1e-3
    3 The answers are 1.499999 2.0001 0
     8        sage: RDF(pi)                               # abs tol 1e-5
     9        3.14159
     10        sage: [10^n for n in [0.0 .. 4]]            # rel tol 2e-4
     11        [0.9999, 10.001, 100.01, 999.9, 10001]
    412}}}
     13
     14This can be useful when the exact output is subject to rounding error
     15and/or processor floating point arithmetic variation.