<div class="gmail_quote">On Thu, Jun 26, 2008 at 8:55 PM, "Martin v. Löwis" <<a href="mailto:martin@v.loewis.de">martin@v.loewis.de</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="Ih2E3d"><br>
</div>I think the feature is misguided in the first place. Why do you want<br>
a hex representation of floating point numbers? </blockquote><div><br></div><div>Answering for myself: because it gives an exact representation of a</div><div>floating-point number in a fairly human-readable format.</div>
<div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Can't you use struct.pack for that?</blockquote><div><br></div><div>struct.pack would only show the bit layout, leaving the user to</div>
<div>manually extract the sign bit, exponent, and fraction, and then make</div><div>sense of the whole thing. The proposed feature works at a higher</div><div>level of abstraction, directly describing the *value* of the float rather</div>
<div>than its bit layout. In particular, this means it'll make sense</div><div>across platforms, regardless of variations in bit layout.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
And, if bin/hex/oct are useful, why not base<br>
6 (say)?<br></blockquote><div><br></div><div>I'd say that bin and hex are special: bin is natural because</div><div>floats are usually thought of, and stored as, binary numbers.</div><div>hex is special because it gives a compact way of representing</div>
<div>a float, and because there's already a history of using hex</div><div>floats in numerical analysis literature and in programming</div><div>languages (C99, Java, ...)</div><div><br></div><div>I have to admit that I can't see much use for octal floats.</div>
<div><br></div><div>Mark</div><div><br></div></div>