A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/attachments/20080626/ef2c536a/attachment.htm below:

<div class="gmail_quote">On Thu, Jun 26, 2008 at 9:30 PM, &quot;Martin v. Löwis&quot; &lt;<a href="mailto:martin@v.loewis.de">martin@v.loewis.de</a>&gt; wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="Ih2E3d">&gt; Answering for myself: &nbsp;because it gives an exact representation of a<br>
&gt; floating-point number in a fairly human-readable format.<br>
<br>
</div>Ok. But<br>
<br>
py&gt; binascii.hexlify(struct.pack(&quot;d&quot;, 3.14))<br>
&#39;1f85eb51b81e0940&#39;<br>
<br>
does that already, no? You won&#39;t know the precise value, but you won&#39;t<br>
know that with hex support, either.<br>
<div class="Ih2E3d"></div></blockquote><div><br></div><div>The output from hex_float(3.14) would be something like:</div><div><br></div><div>&#39;0x1.91eb851eb851fp+1&#39;<br></div><div><br></div><div>The exponent is still usually given in decimal; &nbsp;there&#39;s no need</div>
<div>for it to be hexadecimal for exactness.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">I&#39;d question that the user is able to make sense of a number when<br>

mantissa and exponent is represented in hex.<br>


<div class="Ih2E3d"></div></blockquote><div><br></div><div>I think the above it still a bit easier to understand than</div><div>if one has to figure out where the sign/exponent and</div><div>exponent/fraction bit boundaries are, unbias the exponent,</div>
<div>and add the extra hidden &#39;1&#39; bit into the mantissa. &nbsp;That&#39;s</div><div>a lot of mental work.</div><div><br></div><div>&nbsp;</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Then I&#39;d argue that the feature should be symmetric: If there is<br>
support for printing floating point numbers as hex, there should<br>
also be support for hex floating point literals.<br></blockquote><div><br></div><div>I agree with this. &nbsp;Or at least support for hex floating point</div><div>strings, if not literals.</div><div>&nbsp;</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<br>


Also, to follow C&#39;s tradition, it would be better if that was<br>
*not* integrated into the hex function (or a hex method), but<br>
if there was support for %a in string formatting.<br></blockquote><div><br></div><div>I&#39;d be delighted with &#39;%a&#39; support.</div><div><br></div><div>Mark</div><div><br></div></div>

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4