On Tue, 29 Nov 2022 17:11:51 GMT, Kevin Rushforth <k...@openjdk.org> wrote:
>> John Hendrikx has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Fix indentation > > modules/javafx.graphics/src/main/java/com/sun/javafx/tk/quantum/WindowStage.java > line 422: > >> 420: } >> 421: double similarity = (width - adjw) / (double) width + >> 422: (height - adjh) / (double) height + //Large padding >> is bad > > This change _must_ be reverted. There are cases where doing integer > arithmetic on intermediate results is not equivalent to doing double > arithmetic. > > Consider this: > > > int i = Integer.MAX_VALUE; > int j = -1; > double d1 = (double) i - (double) j; > double d2 = i - j; > > > `d1` will be `2147483648` and `d2` will be `-2147483648`. > > I can't say whether it is possible in practice, but this change is not > acceptable, and is a good example of the general concern I raised. If the casts in the numerator actually matter, then the cast in the denominator can be removed. The latter are the ones that Eclipse flags for me as unnecessary. ------------- PR: https://git.openjdk.org/jfx/pull/960