<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - ECMAScript 2016: %TypedArray%.prototype.includes implementation"
   href="https://bugs.webkit.org/show_bug.cgi?id=159385#c21">Comment # 21</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - ECMAScript 2016: %TypedArray%.prototype.includes implementation"
   href="https://bugs.webkit.org/show_bug.cgi?id=159385">bug 159385</a>
              from <span class="vcard"><a class="email" href="mailto:ticaiolima&#64;gmail.com" title="Caio Lima &lt;ticaiolima&#64;gmail.com&gt;"> <span class="fn">Caio Lima</span></a>
</span></b>
        <pre>Comment on <span class=""><a href="attachment.cgi?id=282752&amp;action=diff" name="attach_282752" title="Patch">attachment 282752</a> <a href="attachment.cgi?id=282752&amp;action=edit" title="Patch">[details]</a></span>
Patch

View in context: <a href="https://bugs.webkit.org/attachment.cgi?id=282752&amp;action=review">https://bugs.webkit.org/attachment.cgi?id=282752&amp;action=review</a>

<span class="quote">&gt;&gt; Source/JavaScriptCore/runtime/JSGenericTypedArrayViewPrototypeFunctions.h:216
&gt;&gt; +    if (!valueToFind.isNumber() &amp;&amp; !valueToFind.isDouble())
&gt; 
&gt; Isn't &quot;isNumber()&quot; a superset of &quot;isDouble()&quot;?
&gt; 
&gt; valueToFind.isNumber() false implies valueToFind.isDouble() false.</span >

You are right. I was considering isDouble because of NaN case, bit Ironically, NaN isNumber is true.

<span class="quote">&gt;&gt; Source/JavaScriptCore/runtime/JSGenericTypedArrayViewPrototypeFunctions.h:222
&gt;&gt; +    typename ViewClass::ElementType target = ViewClass::toAdaptorNativeFromValue(exec, valueToFind);
&gt; 
&gt; I don't think that works for includes.
&gt; 
&gt; For example, Uint8ClampedAdaptor will clamp positive values to 255, that's not what we need here.
&gt; IntegralTypedArrayAdaptor does ToInt32 on the input, that's not what we need either.
&gt; 
&gt; Your test should have extensive coverage of those crazy cases.
&gt; 
&gt; ----
&gt; 
&gt; What you probably need is a new Adaptor function that returns a value in the right type or an error.
&gt; 
&gt; For example, if you pass a double to an integer type array, it returns the integer if it fits in the array type or fail.
&gt; E.g.:
&gt;     -The double 256.0 works for int16, fails for int8
&gt;     -The double 254.1 fails for all integers.</span >

Nice point. I am working in that now.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>