hex float literals in C++

Discussion in 'C++' started by John Salmon, Jan 15, 2007.

  1. John Salmon

    John Salmon Guest

    It is widely acknowledged that C++ is moving toward greater
    compatibility with C99. Great! Where can I find the details?
    I'm particularly interested in support for hexadecimal floating point
    constants.

    I have found the TR1 document which describes new library features

    http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf


    which describes a new 'hexfloat' manipulator and incorporates by
    reference the C99 format conversion specifiers: %a and %A.

    But what about literal floats in program text? Will I be able
    to write:

    float x = 0x1.ap+0;

    in a standards conforming C++ program at some point? I can already
    do this with some (most?) compilers, but I find myself battling the
    "standards compliance police". Is there a draft or a proposal,
    or something that I can reference, so at least I can say "This works
    with the compilers we're using today, and it is on track to be standardized
    in the future, so there's an awfully good chance it will continue to
    work for as long as we need it."

    Thanks,
    John Salmon
    John Salmon, Jan 15, 2007
    #1
    1. Advertising

  2. John Salmon

    mlimber Guest

    John Salmon wrote:
    > It is widely acknowledged that C++ is moving toward greater
    > compatibility with C99. Great! Where can I find the details?
    > I'm particularly interested in support for hexadecimal floating point
    > constants.
    >
    > I have found the TR1 document which describes new library features
    >
    > http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf
    >
    >
    > which describes a new 'hexfloat' manipulator and incorporates by
    > reference the C99 format conversion specifiers: %a and %A.
    >
    > But what about literal floats in program text? Will I be able
    > to write:
    >
    > float x = 0x1.ap+0;
    >
    > in a standards conforming C++ program at some point? I can already
    > do this with some (most?) compilers, but I find myself battling the
    > "standards compliance police". Is there a draft or a proposal,
    > or something that I can reference, so at least I can say "This works
    > with the compilers we're using today, and it is on track to be standardized
    > in the future, so there's an awfully good chance it will continue to
    > work for as long as we need it."


    If you don't get an answer here, you might try on comp.std.c++.

    Cheers! --M
    mlimber, Jan 15, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Goche
    Replies:
    8
    Views:
    16,429
  2. Replies:
    10
    Views:
    6,140
    Neredbojias
    Aug 19, 2005
  3. bd
    Replies:
    0
    Views:
    605
  4. Bengt Richter
    Replies:
    6
    Views:
    449
    Juha Autero
    Aug 19, 2003
  5. Carsten Fuchs
    Replies:
    45
    Views:
    1,506
    James Kanze
    Oct 8, 2009
Loading...

Share This Page