<Swing Dev> [15] RFR JDK-8220811: SpinnerNumberModel floating point rounding issue
Sergey Bylokhov
Sergey.Bylokhov at oracle.com
Thu Feb 13 21:33:40 UTC 2020
On 2/12/20 8:21 am, Alexey Ivanov wrote:
> The bug report says that going from -0.15 to -0.10 does not allow going back to -0.15. This happens because the result of this sequence of operations cannot be represented exactly, or, in other words, because of rounding errors; or rather the result is less than the set minimal value.
>
> Can we set the value of the spinner to the set minimal value instead of disallowing the operation. I mean, after going up the displayed value is -0.10; going down by 0.05 gives the result which is less than the minimal value for the spinner, and thus going down is not allowed. What if we set the value of the spinner to its minimal value instead?
In this case, we will need to update all types including int. Isn't it will be surprised that the spinner will show the value which is not calculated as
"defaultValue + stepValue * stepCount"?
--
Best regards, Sergey.
More information about the swing-dev
mailing list