From 70ebf8299231c5258374a8f6a18f71f277b50ec2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 1 Sep 2016 18:15:56 +0200 Subject: [PATCH] Math: updated fuzzy comparison epsilon values for long double and double. To be consistent with what's for floats. Maybe I'll need to decrease the precision later again, but at least this has now some real background instead of being a guesstimate. --- src/Magnum/Math/TypeTraits.h | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/Magnum/Math/TypeTraits.h b/src/Magnum/Math/TypeTraits.h index 1632b7c89..1e0db2f5b 100644 --- a/src/Magnum/Math/TypeTraits.h +++ b/src/Magnum/Math/TypeTraits.h @@ -33,22 +33,34 @@ #include "Magnum/Types.h" -/** @brief Precision when testing floats for equality */ +/** +@brief Precision when testing floats for equality + +They have "at least" 6 significant digits of precision, taking one digit less +for more headroom. +*/ #ifndef FLOAT_EQUALITY_PRECISION #define FLOAT_EQUALITY_PRECISION 1.0e-5f #endif -/** @brief Precision when testing doubles for equality */ +/** +@brief Precision when testing doubles for equality + +They have "at least" 15 significant digits of precision, taking one digit less +for more headroom. +*/ #ifndef DOUBLE_EQUALITY_PRECISION -#define DOUBLE_EQUALITY_PRECISION 1.0e-12 +#define DOUBLE_EQUALITY_PRECISION 1.0e-14 #endif /** @brief Precision when testing long doubles for equality -@todo some proper value please + +They have "at least" 18 significant digits of precision, taking one digit less +for more headroom. */ #ifndef LONG_DOUBLE_EQUALITY_PRECISION -#define LONG_DOUBLE_EQUALITY_PRECISION 1.0e-18l +#define LONG_DOUBLE_EQUALITY_PRECISION 1.0e-17l #endif namespace Magnum { namespace Math {