Skip to content

better numerical accuracy testing #10952

@robertwb

Description

@robertwb

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.


Related:


Apply

  1. attachment: 10952-tol-bin.2.patch
  2. attachment: trac_10952-ref.patch
    to the Sage scripts repository.

Apply

  1. attachment: 10952-tol-doc.2.patch
  2. attachment: trac_10952-reviewer-docs-v3.patch
    to the Sage library repository.

CC: @jasongrout @kcrisman

Component: doctest coverage

Keywords: sd32 noise noisy doctest failure error tolerance

Author: Robert Bradshaw, Rob Beezer

Reviewer: Jason Grout, Mariah Lenox, William Stein, John Palmieri

Merged: sage-4.7.2.alpha3

Issue created by migration from https://trac.sagemath.org/ticket/10952

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions