• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

d-meiser / cgreen
96%
master: 96%

Build:
Build:
LAST BUILD BRANCH: double_comparison_corrections
DEFAULT BRANCH: master
Repo Added 01 Sep 2015 04:12AM UTC
Files 73
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

LAST BUILD ON BRANCH double_comparison_corrections
branch: SELECT
CHANGE BRANCH
x
  • No branch selected
  • cleanup-cmakelists
  • cmake-sub-project
  • double_comparison_corrections
  • fix-compiler-warnings
  • fix-coverage
  • less-than-double
  • master
  • win32-fixes

pending completion
62

push

travis-ci

d-meiser
Fix double comparisons for small numbers

* Introduce an absolute tolerance.
* Improve implementation of accuracy function to avoid casting and make the
  logic more transparent.
* Add discussion of floating point comparisons to manual.
* Add a test case.
* Minor cosmetic changes (e.g. renamed a test case).
* Remove a test case that compares a small number with 0 because this is
  expected behavior.

Discussion

The introduction of an absolute tolerance fixes the underflow issues near 0. If
two numbers are within the absolute tolerance of one another they are considered
equal and we don't need to evaluate the problematic accuracy function. We choose
an absolute tolerance that is 10^8 times larger than the smallest double number
that can be represented. Eight is the default number of significant digits used
for relative comparisons. This prevents underflow issues when comparing numbers
near zero for the default number of significant digits.

Note that our default cannot prevent underflow if the user increases the number
of significant digits to a value larger than eight. doubles_are_equal will not
crash in this case but it may wrongly report two numbers as equal. The
problematic cases are numbers near zero.

We have added a discussion of our floating point comparison algorithm to the
manual. We point out the problems that can occur when comparing numbers close to
zero and we propose to use constraints of the form

assert_that_double(fabs(x - y), is_less_than_double(abs_tolerance));

in that case.

8 of 8 new or added lines in 2 files covered. (100.0%)

5368 of 5580 relevant lines covered (96.2%)

194457.49 hits per line

Relevant lines Covered
Build:
Build:
5580 RELEVANT LINES 5368 COVERED LINES
194457.49 HITS PER LINE
Source Files on master
  • List 0
  • Changed 0
  • Source Changed 0
  • Coverage Changed 0
Coverage ∆ File Lines Relevant Covered Missed Hits/Line

Recent builds

Builds Branch Commit Type Ran Committer Via Coverage
62 double_comparison_corrections Fix double comparisons for small numbers * Introduce an absolute tolerance. * Improve implementation of accuracy function to avoid casting and make the logic more transparent. * Add discussion of floating point comparisons to manual. * Add a te... push 03 Nov 2017 02:15AM UTC d-meiser travis-ci pending completion  
61 double_comparison_corrections Fix double comparisons for small numbers * Introduce an absolute tolerance. * Improve implementation of accuracy function to avoid casting and make the logic more transparent. * Add discussion of floating point comparisons to manual. * Add a te... push 02 Nov 2017 02:56AM UTC d-meiser travis-ci pending completion  
60 double_comparison_corrections Fix for double comparisons. * Introduce an absolute tolerance. * Improve implementation of accuracy function to avoid casting and make the logic more transparent. * Add a test case. * Minor cosmetic changes (e.g. renamed a test case). Discussi... push 01 Nov 2017 02:21AM UTC d-meiser travis-ci pending completion  
55 double_comparison_corrections Add tests for issues with double comparisons push 31 Oct 2017 02:48AM UTC Thomas Nilefalk travis-ci pending completion  
54 master Add comment on which issue the test addresses push 31 Oct 2017 02:47AM UTC thoni56 travis-ci pending completion  
53 win32-fixes Fix find_index_of_difference I think this was supposed to compute the difference of the pointers as if they were size_t's (or ssize_t). push 04 Jun 2017 02:26PM UTC d-meiser travis-ci pending completion  
50 master Implement #129, warn for unused return value from 'mock()', which might happen because of a typo push 04 Jun 2017 02:06AM UTC thoni56 travis-ci pending completion  
49 cleanup-cmakelists Delete "project" lines in CMakeLists.txt in sub folders. push 13 Feb 2016 11:28PM UTC d-meiser travis-ci pending completion  
48 cleanup-cmakelists Fix a few paths. push 13 Feb 2016 11:19PM UTC d-meiser travis-ci pending completion  
45 master Merge pull request #1 from d-meiser/fix-compiler-warnings Remove unused static variable. push 21 Dec 2015 03:25PM UTC d-meiser travis-ci pending completion  
See All Builds (32)
  • Repo on GitHub
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc