mirror of
https://github.com/subsurface/subsurface.git
synced 2024-12-01 06:30:26 +00:00
Improve floating point equality test
This allows for a relative error rather than an absolute (which would set an artificial scale). This basically says “we trust our data (which comes from the dive computer’s measurement after all) to a certain number of significant digits” rather than “we will never encounter anything smaller than 1 / a million but not zero” which would be awfully unit dependent. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
a566dbdaf7
commit
b6a30dcdd3
1 changed files with 1 additions and 1 deletions
2
dive.h
2
dive.h
|
@ -20,7 +20,7 @@
|
|||
(void) (&_max1 == &_max2); \
|
||||
_max1 > _max2 ? _max1 : _max2; })
|
||||
|
||||
#define IS_FP_SAME(_a,_b) (abs((_a) - (_b)) < 0.000001)
|
||||
#define IS_FP_SAME(_a,_b) (abs((_a) - (_b)) < 0.000001 * MAX(abs(_a), abs(_b)))
|
||||
|
||||
#include <libxml/tree.h>
|
||||
#include <libxslt/transform.h>
|
||||
|
|
Loading…
Reference in a new issue