<html><body><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000"><div><br></div><div><br></div><hr id="zwchr" data-marker="__DIVIDER__"><div data-marker="__HEADERS__"><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><b>From: </b>"Guy Steele" <guy.steele@oracle.com><br><b>To: </b>"Brian Goetz" <brian.goetz@oracle.com><br><b>Cc: </b>"Remi Forax" <forax@univ-mlv.fr>, "Angelos Bimpoudis" <angelos.bimpoudis@oracle.com>, "amber-spec-experts" <amber-spec-experts@openjdk.org><br><b>Sent: </b>Thursday, January 26, 2023 4:25:16 PM<br><b>Subject: </b>Re: Draft JEP on Primitive types in patterns, instanceof, and switch<br></blockquote></div><div><style style="display:none;" class="">P {margin-top:0;margin-bottom:0;}</style></div><div data-marker="__QUOTED_TEXT__"><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;">
<br class="">
<div><br class="">
<blockquote class="">
<div class="">On Jan 26, 2023, at 9:36 AM, Brian Goetz <<a href="mailto:brian.goetz@oracle.com" class="" target="_blank">brian.goetz@oracle.com</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div class=""><font class="" size="4"><font class="" face="monospace">... <br class=""><br class="">
For comparing a variable to a constant, representational equality is the obvious interpretation; `case nnn` means "is it the number nnn". This allows you to say `case NaN` and `case -0` and get the right answer (all of these relations agree on what to do about
1.0). <br class=""></font></font></div>
</div>
</blockquote>
<br class="">
</div>
<div>Careful: I think you had better say “<font class="" face="Menlo"><span style="font-style: normal;" class="">case -0.0</span></font>”; otherwise the constant expression “<font class="" face="Menlo"><span style="font-style: normal;" class="">-0</span></font>”
will be reduced to “<font class="" face="Menlo"><span style="font-style: normal;" class="">0</span></font>” and only then converted to floating-point representation, producing
<font class="" face="Menlo"><span style="font-style: normal;" class="">+0.0</span></font>.</div>
<div class=""><br class="">
</div>
Yes, floating-point is VERY fiddly.
</blockquote><div><br></div><div>As i read the current spec, case -0 is equivalent to case 0, and you can not have both of them in the same switch.<br></div><div><br data-mce-bogus="1"></div><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><div class=""><br class="">
<div class="">—Guy</div>
<div class=""><br class="">
</div>
</div></blockquote><div><br></div><div>Rémi<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div></div></div></body></html>