<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jun 18, 2014 at 12:02 PM, Duncan P. N. Exon Smith <span dir="ltr"><<a href="mailto:dexonsmith@apple.com" target="_blank">dexonsmith@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class=""><br>
> On 2014 Jun 18, at 09:29, Sean Silva <<a href="mailto:chisophugis@gmail.com">chisophugis@gmail.com</a>> wrote:<br>
><br>
> Why not just use APFloat? (maybe even APInt would be sufficient for the desired semantics?)<br>
<br>
</div>APFloat's API is awkward to use when doing math -- it's designed for<br>
compiling and optimizing code that uses floats, not for use as a simple<br>
number representation.<br>
<br>
It is possible to wrap APFloat though.<br>
<div class=""><br>
> Is it purely a performance concern?<br>
<br>
</div>Largely (assuming the other option is wrapping APFloat).<br>
<br>
Also, wrapping APFloat to give similar semantics is a fair bit a work.<br>
<br>
UnsignedFloat interoperates well with integers -- it's easy to compose out<br>
of (and decompose into) exponent and digit parts.  Again, this is API that<br>
could be added as a wrapper around APFloat.<br>
<div class=""><br>
> Because it seems like you (and Andy) are supporting this as a suboptimal but convenient replacement for a proper integer-based representation.<br>
<br>
</div>In a way, but I think of it as a suboptimal but safe replacement for<br>
hardware floats.  We currently use hardware floats as a suboptimal but<br>
convenient replacement for proper integer-based representations -- I'd like<br>
to swap in a soft-float instead.<br></blockquote><div><br></div><div>Cool, this makes sense to me.<br><br></div><div>-- Sean Silva<br> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<br>
For some problems, proper integer-based representations are really hard,<br>
and can resemble a poor man's soft-float even when done right.<br>
<div class=""><br>
> On the other hand, if it's just a performance optimization over APFloat/APInt, then this soft-float thing becomes quick hack + optimization which is a combination that gives me a pretty bad gut feeling (but may still be warranted, of course).<br>

<br>
</div>It's a performance optimization over: a heavily wrapped APFloat to give it<br>
simple semantics.  Not sure if that gives you a better feeling...<br>
</blockquote></div><br></div></div>