[Bf-blender-cvs] [f0a3ea5] master: Fix for weak floating-point number comparison.

Tamito Kajiyama noreply at git.blender.org
Wed Jun 18 07:18:59 CEST 2014


Commit: f0a3ea54f86256c229735c5766e9edfe8ba2acd4
Author: Tamito Kajiyama
Date:   Wed Jun 18 13:13:22 2014 +0900
https://developer.blender.org/rBf0a3ea54f86256c229735c5766e9edfe8ba2acd4

Fix for weak floating-point number comparison.

Was causing assertion failures in MinGW-w64.

===================================================================

M	source/blender/editors/interface/interface_utils.c

===================================================================

diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c
index 2c958c5..744ed7e 100644
--- a/source/blender/editors/interface/interface_utils.c
+++ b/source/blender/editors/interface/interface_utils.c
@@ -253,7 +253,7 @@ int uiFloatPrecisionCalc(int prec, double value)
 	static const double max_pow = 10000000.0;  /* pow(10, UI_PRECISION_FLOAT_MAX) */
 
 	BLI_assert(prec <= UI_PRECISION_FLOAT_MAX);
-	BLI_assert(pow10_neg[prec] == pow(10, -prec));
+	BLI_assert(fabs(pow10_neg[prec] - pow(10, -prec)) < 1e-16);
 
 	/* check on the number of decimal places need to display the number, this is so 0.00001 is not displayed as 0.00,
 	 * _but_, this is only for small values si 10.0001 will not get the same treatment.




More information about the Bf-blender-cvs mailing list