From 695222838699921865a1f5685c420c9155f27ca7 Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Tue, 18 Jan 2022 12:00:09 +0300 Subject: UI: fix a precision issue with float field step size. Fix a precision issue when stepping down from 1 to 0 via the left decrement button and step 100 results in a small nonzero value. The reason is that 0.01 can't be precisely represented in binary and converting to double before multiplication reveals this. Ref D13753 --- source/blender/editors/interface/interface_handlers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 6ecaead67ce..905fd452b6c 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -5484,7 +5484,7 @@ static int ui_do_but_NUM( log10f(number_but->step_size)); } else { - value_step = (double)number_but->step_size * UI_PRECISION_FLOAT_SCALE; + value_step = (double)(number_but->step_size * UI_PRECISION_FLOAT_SCALE); } BLI_assert(value_step > 0.0f); const double value_test = (but->drawflag & UI_BUT_ACTIVE_LEFT) ? -- cgit v1.2.3