hex float literals in C++

J

John Salmon

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
 
M

mlimber

John said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top