Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > hex float literals in C++

Reply
Thread Tools

hex float literals in C++

 
 
John Salmon
Guest
Posts: n/a
 
      01-15-2007

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/wg...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
 
Reply With Quote
 
 
 
 
mlimber
Guest
Posts: n/a
 
      01-15-2007
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/wg...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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
float to string to float, with first float == second float Carsten Fuchs C++ 45 10-08-2009 09:47 AM
Java: byte literals and short literals John Goche Java 8 01-17-2006 11:12 PM
Hex Color Codes - Hex 6 <=> Hex 3 lucanos@gmail.com HTML 10 08-18-2005 11:21 PM
hex(-5) => Futurewarning: ugh, can't we have a better hex than '-'[:n<0]+hex(abs(n)) ?? Bengt Richter Python 6 08-19-2003 07:33 AM
Re: float->byte->float is same with original float image. why float->ubyte->float is different??? bd C Programming 0 07-07-2003 12:09 AM



Advertisments