[issue3008] Let bin/oct/hex show floats

2008-07-15 Thread Mark Dickinson
Changes by Mark Dickinson [EMAIL PROTECTED]: ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3008 ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue3008] Let bin/oct/hex show floats

2008-07-15 Thread Mark Dickinson
Mark Dickinson [EMAIL PROTECTED] added the comment: Here's an updated patch that addresses Raymond's concerns. The patch looks good. I would coded hex_from_char() using a lookup into 0123456789abcdef which uses no unpredicatable branches. Likewise, I would done hex_from_char() with a

[issue3008] Let bin/oct/hex show floats

2008-07-15 Thread Guido van Rossum
Guido van Rossum [EMAIL PROTECTED] added the comment: If you two can agree that this code is good, I'm ok with the API. I would emphasize in the docs and NEWS entry though that .hex() is an *instance* method while .fromhex() is a *class* method. ___ Python

[issue3008] Let bin/oct/hex show floats

2008-07-15 Thread Raymond Hettinger
Raymond Hettinger [EMAIL PROTECTED] added the comment: Mark, please go ahead and apply so the buildbots will have time to give it a run on all the platforms before beta 2 is cut. Be sure to make Guido's edits to the Misc/NEWS entry. ___ Python tracker

[issue3008] Let bin/oct/hex show floats

2008-07-14 Thread Raymond Hettinger
Raymond Hettinger [EMAIL PROTECTED] added the comment: The patch looks good. I would coded hex_from_char() using a lookup into 0123456789abcdef which uses no unpredicatable branches. Likewise, I would done hex_from_char() with a case statement (limiting the call to single unpredicatable

[issue3008] Let bin/oct/hex show floats

2008-07-13 Thread Raymond Hettinger
Raymond Hettinger [EMAIL PROTECTED] added the comment: So far this looks good. Will complete the review on the next leg of my flight (about 12 hrs). ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3008

[issue3008] Let bin/oct/hex show floats

2008-07-12 Thread Mark Dickinson
Mark Dickinson [EMAIL PROTECTED] added the comment: Here's an updated patch that makes the trailing 'p123' exponent optional in fromhex. (This matches the behaviour of C99's strtod and sscanf; in contrast, Java always requires the exponent.) I'm beginning to wonder whether the '0x'

[issue3008] Let bin/oct/hex show floats

2008-07-12 Thread Mark Dickinson
Mark Dickinson [EMAIL PROTECTED] added the comment: In the spirit of being liberal in what you accept, but strict in what you emit, here's a version that makes both the leading '0x' and the trailing 'p...' exponent optional on input. Both of these are still produced on output. Note that

[issue3008] Let bin/oct/hex show floats

2008-07-12 Thread Mark Dickinson
Mark Dickinson [EMAIL PROTECTED] added the comment: Some final tinkering: - docstrings and docs expanded slightly; docs mention interoperability with C and Java. - in float.hex(), there's always a sign included in the exponent (e.g. 0x1p+0 instead of 0x1p0). This just makes for a little

[issue3008] Let bin/oct/hex show floats

2008-07-11 Thread Mark Dickinson
Mark Dickinson [EMAIL PROTECTED] added the comment: Minor modifications to the previous patch, mostly to the docs. Setting priority to critical, since this really needs to go in before the next beta if it's going to get into 2.6/3.0. -- priority: - critical Added file:

[issue3008] Let bin/oct/hex show floats

2008-07-10 Thread Mark Dickinson
Mark Dickinson [EMAIL PROTECTED] added the comment: Here's a slightly more polished version of the previous patch; no behaviour changes. Let me know if there's anything I can do to help get this in before next week's beta. Anybody want to trade patch reviews? Added file:

[issue3008] Let bin/oct/hex show floats

2008-07-05 Thread Mark Dickinson
Mark Dickinson [EMAIL PROTECTED] added the comment: In the interests of getting early feedback, here's half a patch, containing an implementation of from.fromhex and tests. Still to come: float.hex and documentation. I'll ask on python-dev about C99 and %a. Added file:

[issue3008] Let bin/oct/hex show floats

2008-07-05 Thread Mark Dickinson
Mark Dickinson [EMAIL PROTECTED] added the comment: containing an implementation of from.fromhex and tests. That should be 'float.fromhex', not 'from.fromhex'. I should also have said that this patch is against the trunk; only minor changes should be required for py3k.

[issue3008] Let bin/oct/hex show floats

2008-07-05 Thread Mark Dickinson
Mark Dickinson [EMAIL PROTECTED] added the comment: Here's an updated patch, complete with both float methods and documentation. Added file: http://bugs.python.org/file10815/hex_float2.patch ___ Python tracker [EMAIL PROTECTED]

[issue3008] Let bin/oct/hex show floats

2008-07-05 Thread Mark Dickinson
Mark Dickinson [EMAIL PROTECTED] added the comment: Add updated patch with expanded documentation. Added file: http://bugs.python.org/file10816/hex_float2.patch ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3008

[issue3008] Let bin/oct/hex show floats

2008-07-05 Thread Mark Dickinson
Changes by Mark Dickinson [EMAIL PROTECTED]: Removed file: http://bugs.python.org/file10815/hex_float2.patch ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3008 ___

[issue3008] Let bin/oct/hex show floats

2008-07-04 Thread Mark Dickinson
Mark Dickinson [EMAIL PROTECTED] added the comment: I'm working on it. I expect to have something ready by the end of this weekend. ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3008 ___

[issue3008] Let bin/oct/hex show floats

2008-07-04 Thread Guido van Rossum
Guido van Rossum [EMAIL PROTECTED] added the comment: BTW couldn't you use the %a feature built into C99 to implement this? (Both input and output?) ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3008 ___

[issue3008] Let bin/oct/hex show floats

2008-07-04 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc [EMAIL PROTECTED] added the comment: Microsoft compilers implement %a since VS8.0. VS7.1 does not have it. ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3008 ___

[issue3008] Let bin/oct/hex show floats

2008-07-03 Thread Guido van Rossum
Guido van Rossum [EMAIL PROTECTED] added the comment: Raymond, Mark? Is a new patch with tests and docs forthcoming? Have you decided on the API yet? I'm willing to approve this for beta 2, which will be around July 15. -- assignee: gvanrossum - rhettinger

[issue3008] Let bin/oct/hex show floats

2008-06-30 Thread Mark Dickinson
Mark Dickinson [EMAIL PROTECTED] added the comment: Here's an updated Python version of toHex and fromHex; fixes a bug in the previous version of fromHex for hex floats starting with an upper case hex digit. I'm not sure how useful this is, but I thought I might as well post the code. I

[issue3008] Let bin/oct/hex show floats

2008-06-30 Thread Mark Dickinson
Mark Dickinson [EMAIL PROTECTED] added the comment: ...and the tests for hex_float.py Added file: http://bugs.python.org/file10786/test_hex_float.py ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3008 ___

[issue3008] Let bin/oct/hex show floats

2008-06-30 Thread Mark Dickinson
Changes by Mark Dickinson [EMAIL PROTECTED]: Removed file: http://bugs.python.org/file10780/hex_float.py ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3008 ___

[issue3008] Let bin/oct/hex show floats

2008-06-30 Thread Raymond Hettinger
Raymond Hettinger [EMAIL PROTECTED] added the comment: I'm looking forward to your C implementation. ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3008 ___ ___

[issue3008] Let bin/oct/hex show floats

2008-06-29 Thread Mark Dickinson
Mark Dickinson [EMAIL PROTECTED] added the comment: Here's some Python code to translate floats to hex strings and back, in case it's useful. Added file: http://bugs.python.org/file10780/hex_float.py ___ Python tracker [EMAIL PROTECTED]

[issue3008] Let bin/oct/hex show floats

2008-06-29 Thread Mark Dickinson
Changes by Mark Dickinson [EMAIL PROTECTED]: Removed file: http://bugs.python.org/file10729/hex_float.py ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3008 ___

[issue3008] Let bin/oct/hex show floats

2008-06-25 Thread Mark Dickinson
Mark Dickinson [EMAIL PROTECTED] added the comment: -1 on Nick's suggestion to normalize hex output so that nearby floats have nearby reprs. This unnecessarily complicates a simple, straight- forward presentation. In the paper referenced by Terry Reedy, normalized presentations were not

[issue3008] Let bin/oct/hex show floats

2008-06-25 Thread Raymond Hettinger
Raymond Hettinger [EMAIL PROTECTED] added the comment: How would the algorithm need to change to support leading-1 normalization? ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3008 ___

[issue3008] Let bin/oct/hex show floats

2008-06-25 Thread Mark Dickinson
Mark Dickinson [EMAIL PROTECTED] added the comment: Well, here's some Python code to output C99-style hexadecimal representations of floats. It's not quite the same as Java's output, which also special cases IEEE 754 subnormals (writing them with a fixed exponent of -1022 and a '0' before

[issue3008] Let bin/oct/hex show floats

2008-06-25 Thread Raymond Hettinger
Raymond Hettinger [EMAIL PROTECTED] added the comment: Attaching a patch that includes normalization to a leading 1. Added file: http://bugs.python.org/file10731/float8.diff ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3008

[issue3008] Let bin/oct/hex show floats

2008-06-24 Thread Raymond Hettinger
Changes by Raymond Hettinger [EMAIL PROTECTED]: -- assignee: rhettinger - gvanrossum nosy: +gvanrossum title: Let bin() show floats - Let bin/oct/hex show floats ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3008

[issue3008] Let bin/oct/hex show floats

2008-06-24 Thread Raymond Hettinger
Raymond Hettinger [EMAIL PROTECTED] added the comment: Updating patch so that the global symbol starts with _Py. Added file: http://bugs.python.org/file10726/float7.diff ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3008