On Thu, Nov 5, 2009 at 8:07 PM, Anne Archibald <span dir="ltr"><<a href="mailto:peridot.faceted@gmail.com">peridot.faceted@gmail.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
2009/11/5 David Goldsmith <<a href="mailto:d.l.goldsmith@gmail.com">d.l.goldsmith@gmail.com</a>>:<br>
<div><div></div><div class="h5">> On Thu, Nov 5, 2009 at 3:26 PM, David Warde-Farley <<a href="mailto:dwf@cs.toronto.edu">dwf@cs.toronto.edu</a>><br>
> wrote:<br>
>><br>
>> On 5-Nov-09, at 4:54 PM, David Goldsmith wrote:<br>
>><br>
>> > Interesting thread, which leaves me wondering two things: is it<br>
>> > documented<br>
>> > somewhere (e.g., at the IEEE site) precisely how many *decimal*<br>
>> > mantissae<br>
>> > are representable using the 64-bit IEEE standard for float<br>
>> > representation<br>
>> > (if that makes sense);<br>
>><br>
>> IEEE-754 says nothing about decimal representations aside from how to<br>
>> round when converting to and from strings. You have to provide/accept<br>
>> *at least* 9 decimal digits in the significand for single-precision<br>
>> and 17 for double-precision (section 5.6). AFAIK implementations will<br>
>> vary in how they handle cases where a binary significand would yield<br>
>> more digits than that.<br>
><br>
> I was actually more interested in the opposite situation, where the decimal<br>
> representation (which is what a user would most likely provide) doesn't have<br>
> a finite binary expansion: what happens then, something analogous to the<br>
> decimal "rule of fives"?<br>
<br>
</div></div>If you interpret "0.1" as 1/10, then this is a very general<br>
floating-point issue: how you you round off numbers you can't<br>
represent exactly? The usual answer (leaving aside internal<br>
extended-precision shenanigans) is to round, with the rule that when<br>
you're exactly between two floating-point numbers you round to the one<br>
that's even, rather than always up or always down (the numerical<br>
analysis wizards tell us that this is more numerically stable).<br></blockquote><div><br>More numerically stable, or simply unbiased, since half the time your rounding up, and the other half rounding down (that's the rationale as it was explained to me).<br>
<br>DG <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
Anne<br>
<br>
> DG<br>
<div><div></div><div class="h5">><br>
> _______________________________________________<br>
> NumPy-Discussion mailing list<br>
> <a href="mailto:NumPy-Discussion@scipy.org">NumPy-Discussion@scipy.org</a><br>
> <a href="http://mail.scipy.org/mailman/listinfo/numpy-discussion" target="_blank">http://mail.scipy.org/mailman/listinfo/numpy-discussion</a><br>
><br>
><br>
_______________________________________________<br>
NumPy-Discussion mailing list<br>
<a href="mailto:NumPy-Discussion@scipy.org">NumPy-Discussion@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/numpy-discussion" target="_blank">http://mail.scipy.org/mailman/listinfo/numpy-discussion</a><br>
</div></div></blockquote></div><br>