eunit icon indicating copy to clipboard operation
eunit copied to clipboard

approximate float/number comparison assertions in eunit

Open richcarl opened this issue 12 years ago • 0 comments

There should be macros in eunit for asserting that 1) a float (or any number) is within some epsilon from some other number (absolute error), 2) that the relative error is within some percentage, 3) that two numbers are "close". It is unclear if all of these are needed, or just 1-2, or even just 1.

References:

​http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm

​http://www.boost.org/doc/libs/1_35_0/libs/test/doc/components/test_tools/floating_point_comparison.html

​http://www.cs.otago.ac.nz/staffpriv/ok/software.htm (pcfpcmp)

richcarl avatar Jul 06 '12 21:07 richcarl