On Fri, 20 Nov 2026 01:13:10 GMT, Chen Liang <[email protected]> wrote:

> Same bug exists for any fp to subint conversion. In the java bytecode, f2i 
> and d2i are saturating but i2c/i2s/i2b are truncating, so a fp that's out of 
> char/short range can get a weird conversion.

Yes, the same behavior/mis-behavior occurs for converting `float` and `double` 
to integral types smaller than `int`.

As in other parts of the Java platform design, for integral types only `int` 
and `long` have full support.

However, since `short` is the same size as Float16, there is a stronger case 
for a one-step conversion of Float16 to `short`, than, say, `double` to short.

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

PR Comment: https://git.openjdk.org/jdk/pull/33980#issuecomment-7030240267

Reply via email to