On Wed, 23 Nov 2022 07:26:31 GMT, John Hendrikx <jhendr...@openjdk.org> wrote:

>> Actually, I think the new code correct, though less clear, since `(long)` is 
>> applied to `physicalWidth` before the multiplication. The fact that we had 
>> to scratch our head and discuss it highlights the point I was trying to 
>> make. I do think this is one place where reverting the code back would be 
>> best. Then it's obvious that all of the intermediate calculations are in 
>> long.
>
> The cast has precedence and Java will not downcast mid calculation and lose 
> precision, so all examples here are correct.

`4L * physicalWidth * physicalHeight;` does not require an explicit cast, so I 
think it's the clearest.

-------------

PR: https://git.openjdk.org/jfx/pull/960

Reply via email to