UCL / UCL/STIR

RunTests::check_if_equal for floats/doubles cannot distinguish between relative and absolute error

Open
#202 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
160
Forks
113
Avg merge
12d 15h
Merged PRs (30d)
1

Description

After fixing #183 at PR #198, we now do

    const double diff = fabs(b-a);
    if (diff <= tolerance)
            return true;

    const double largest = (std::max(fabs(b), fabs(a)));
    return ( diff <= tolerance*largest);

However, in many cases for floats, you might just want to do a relative error, where the 2 tolerances really could have very different values.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing RunTests::check_if_equal and the changes described in PR #198 and issue #183. Determine how relative and absolute tolerances should be distinguished for floats and doubles, then verify the intended behavior with cases where the two tolerances differ; the work is done when those modes are separately supported and validated.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
testing-qa
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.