[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [37289] trunk/blender/source/blender/ editors/interface/interface.c: fix for glitch in previous commit with 0. 00002 displaying as 0.000020, this uses 2 calls to double_round which I' d rather avoid but at least it now works right for users.
Campbell Barton
ideasman42 at gmail.com
Tue Jun 7 07:26:10 CEST 2011
Revision: 37289
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37289
Author: campbellbarton
Date: 2011-06-07 05:26:10 +0000 (Tue, 07 Jun 2011)
Log Message:
-----------
fix for glitch in previous commit with 0.00002 displaying as 0.000020, this uses 2 calls to double_round which I'd rather avoid but at least it now works right for users.
Modified Paths:
--------------
trunk/blender/source/blender/editors/interface/interface.c
Modified: trunk/blender/source/blender/editors/interface/interface.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface.c 2011-06-07 05:07:59 UTC (rev 37288)
+++ trunk/blender/source/blender/editors/interface/interface.c 2011-06-07 05:26:10 UTC (rev 37289)
@@ -467,9 +467,15 @@
double prec_d_floor = floor(prec_d + FLT_EPSILON);
int test_prec= (int)prec_d_floor;
- /* this check is so 0.00016 from isnt rounded to 0.0001 _but_ it is not working ideally because 0.0002 becomes 0.00020 */
- if(prec_d - prec_d_floor > FLT_EPSILON) {
- test_prec += 2;
+ /* this check is so 0.00016 from isnt rounded to 0.0001 */
+ if(prec_d - prec_d_floor > FLT_EPSILON) { /* not ending with a .0~001 */
+ /* check if a second decimal place is needed 0.00015 for eg. */
+ if(double_round(value, test_prec + 1) - double_round(value, test_prec + 2) != 0.0) {
+ test_prec += 2;
+ }
+ else {
+ test_prec += 1;
+ }
}
if(test_prec > prec && test_prec <= 7) {
More information about the Bf-blender-cvs
mailing list