<div dir="ltr">This is for matching float literals and for that it should provide good enough value. I don't think people will want to match the result of computations here and if they do want that, we can add more complex matchers.</div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Feb 3, 2015 at 6:41 PM, Kim Gräsman <span dir="ltr"><<a href="mailto:kim.grasman@gmail.com" target="_blank">kim.grasman@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Daniel,<br>
<span class=""><br>
On Tue, Feb 3, 2015 at 10:45 AM, Daniel Jasper <<a href="mailto:djasper@google.com">djasper@google.com</a>> wrote:<br>
> Author: djasper<br>
> Date: Tue Feb  3 03:45:52 2015<br>
> New Revision: 227956<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=227956&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=227956&view=rev</a><br>
> Log:<br>
> Add some overloads so that floating point literals can be AST matched properly.<br>
><br>
> I am not entirely sure whether the implemented sematics are ideal. In<br>
> particular, should floatLiteral(equals(0.5)) match "0.5f" and should<br>
> floatLiteral(equals(0.5f)) match "0.5". With the overloads in this<br>
> patch, the answer to both questions is yes, but I am happy to change<br>
> that.<br>
<br>
</span>This looks scary to me given the general difficulties in comparing floats:<br>
<a href="https://randomascii.wordpress.com/2013/07/16/floating-point-determinism/" target="_blank">https://randomascii.wordpress.com/2013/07/16/floating-point-determinism/</a><br>
<br>
Or is it safe because they're both fixed literals and not the result<br>
of a calculation? Then again, nothing prevents me from doing;<br>
<br>
  floatLiteral(equals(sqrt(AnArgument)))<br>
<span class="HOEnZb"><font color="#888888"><br>
- Kim<br>
</font></span></blockquote></div><br></div>