diff options
author | Alexander Gavrilov <angavrilov@gmail.com> | 2022-01-18 12:00:09 +0300 |
---|---|---|
committer | Alexander Gavrilov <angavrilov@gmail.com> | 2022-01-18 16:24:54 +0300 |
commit | 695222838699921865a1f5685c420c9155f27ca7 (patch) | |
tree | e5b29a0b3ea274a3a80b9a7fef201e5f6290f9fc /source/blender | |
parent | 6a8ad00bccdf5cf8e52991e1ca17b12db7b1bab2 (diff) |
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
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 2 |
1 files changed, 1 insertions, 1 deletions
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) ? |