[External] : Re: Classfile API tracking RFEs

Michael van Acken michael.van.acken at gmail.com
Wed Mar 8 07:23:14 UTC 2023


Am Mi., 8. März 2023 um 08:05 Uhr schrieb Adam Sotona <
adam.sotona at oracle.com>:

>
>
> Oh, and constantInstruction() properly handling -0.0d and -0.0f would be
> nice.  This is the
>
> one patch I have been carrying around since the very beginning that has
> not been resolved.
>
>
>
> -- mva
>
>
>
> Hi Michael,
>
> Do you know some cases of -0.0d and -0.0f wrong handling?
>

I don't quite understand the question.

Negative zero compares as ==-equal to positive zero under IEEE-754, but
the two are distinct bit patterns.  Both javac and jshell treat them as
distinct,
as do equals() and compareTo().

jshell> 0.0f == -0.0f
$3 ==> true

jshell> Float.floatToRawIntBits(0.0f)
$4 ==> 0

jshell> Float.floatToRawIntBits(-0.0f)
$5 ==> -2147483648

The current constantInstruction would lead to a different output for the
last line,
by squashing the value to 0.0f.

-- mva
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/classfile-api-dev/attachments/20230308/aa95cec0/attachment.htm>


More information about the classfile-api-dev mailing list