On Thu, Jun 26, 2008 at 9:55 PM, Mark Dickinson <[EMAIL PROTECTED]> wrote:
>
> It's disadvantage from Python's point of view is that some features are IEEE
> 754
Aargh! I can't believe I wrote that. Its. Its. Its. Anyway; some
more detail:
Both C99 and Java 1.5/1.6 support hex floating-point literals; both
in exactly the
same format, as far as I can tell. Here are the relevant productions
from the Java
grammar:
HexDigit: one of
0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F
HexNumeral:
0 x HexDigits
0 X HexDigits
HexDigits:
HexDigit
HexDigit HexDigits
HexadecimalFloatingPointLiteral:
HexSignificand BinaryExponent FloatTypeSuffix_opt
HexSignificand:
HexNumeral
HexNumeral .
0x HexDigits_opt . HexDigits
0X HexDigits_opt . HexDigits
BinaryExponent:
BinaryExponentIndicator SignedInteger
BinaryExponentIndicator:one of
p P
Java's 'Double' class has a 'toHexString' method that
outputs a valid hex floating point string, and the Double()
constructor also accepts such strings.
C99 also appears to have full support for input/output
of hex floats; e.g. using strtod and printf('%a', ...).
Not sure how helpful this is.
Mark
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com