RFR: JDK-8298060: Fix precision bug in gesture recognizer classes
Andy Goryachev
angorya at openjdk.org
Mon Dec 12 22:08:06 UTC 2022
On Mon, 12 Dec 2022 22:03:31 GMT, John Hendrikx <jhendrikx at openjdk.org> wrote:
>> modules/javafx.graphics/src/main/java/com/sun/javafx/tk/quantum/ScrollGestureRecognizer.java line 252:
>>
>>> 250: factorX = deltaX / scrollMagnitude;
>>> 251: factorY = deltaY / scrollMagnitude;
>>> 252: initialInertiaScrollVelocity = scrollMagnitude / nanosPassed * NANOS_TO_SECONDS;
>>
>> is this correct? shouldn't it be `scrollMagnitude / (nanosPassed * NANOS_TO_SECONDS)`?
>
> I think it's correct, unless you have reason to believe why it wouldn't be. `scrollMagnitude` is a double, and the division and multiplication that follow it will be all done as doubles.
your change is equivalent to
(scrollMagnitude * NANOS_TO_SECONDS) / nanosPassed
is that correct?
-------------
PR: https://git.openjdk.org/jfx/pull/966
More information about the openjfx-dev
mailing list