(Menu) Snap a stepped float to its minimum too

The left action of a float setting now snaps a value within half a
step of an enforced minimum to it, as the right action does at the
maximum. Five 0.001 steps down from 0.005 land at -7e-10, which
prints as -0.000 and is stored as such; they land at 0 now.
This commit is contained in:
LibretroAdmin authored and libretroadmin committed 2026-09-06 18:20:33 +02:00
1 parent 2323c32574
commit e0cb387db7
1 file changed
+5
+5
View File
@@ -1174,6 +1174,11 @@ static int setting_fraction_action_left_default(
else
*setting->value.target.fraction = min;
}
/* Within half a step of the minimum is the minimum: the steps
* that led here were each a float subtraction, and what lands
* a few ulps under 0 prints as -0.000 and is stored as such. */
else if (*setting->value.target.fraction < min + half_step)
*setting->value.target.fraction = min;
}
return 0;