<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    <font size="4"><font face="monospace">Yes, pardon my quick typing. 
        <br>
        <br>
        More specifically, a case constant is not a _constant pattern_
        (at least, not yet), it is just a constant case label. 
        Constants are typed, and they carray both a type match and a
        value match.  When you say <br>
        <br>
            case 0<br>
        <br>
        this is a constant for an int, and doesn't match a floating
        point zero (if the match target is `float`, it won't even
        compile.)  Similarly, `case 0.0` is a constant for a float, and
        is not applicable to a match target of int.  (We do have the
        usual tolerance for matching int constants to shorter int types,
        as before.)<br>
        <br>
        We may generalize these to constant patterns in the future, but
        right now, these are constant case labels and their semantics
        are derived from that of existing case labels.<br>
      </font></font><br>
    <div class="moz-cite-prefix">On 1/26/2023 10:25 AM, Guy Steele
      wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:C807CF96-D350-476C-8343-EC1218ECB5AB@oracle.com">
      
      <br class="">
      <div><br class="">
        <blockquote type="cite" class="">
          <div class="">On Jan 26, 2023, at 9:36 AM, Brian Goetz <<a href="mailto:brian.goetz@oracle.com" class="moz-txt-link-freetext" moz-do-not-send="true">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.
      <div class=""><br class="">
        <style style="display:none;" class="">P {margin-top:0;margin-bottom:0;}</style>
        <div class="">—Guy</div>
        <div class=""><br class="">
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>