Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Does stream I/O support "%a" floating-point format?

Reply
Thread Tools

Does stream I/O support "%a" floating-point format?

 
 
John Friedland
Guest
Posts: n/a
 
      07-21-2006
'printf' has a '%a' conversion for floating-point output:

> The `%a' and `%A' conversions are meant for representing
>floating-point numbers exactly in textual form so that they can be
>exchanged as texts between different programs and/or machines. The
>numbers are represented is the form [`-']`0x'H`.'HHH`p'[`+'|`-']DD.


For example, printing '123456' with "|%13.4a|" produces

| 0x1.e240p+16|

I've looked through Josuttis and the header files, but I can't find
any flags or manipulators that could handle this. Is this possible
with stream I/O?

Supplementary question: does anyone know how to search for a '%a' in
Google groups?

Thanks -

John
 
Reply With Quote
 
 
 
 
Pete Becker
Guest
Posts: n/a
 
      07-21-2006
John Friedland wrote:
> 'printf' has a '%a' conversion for floating-point output:
>


The %a and %A conversion specifiers are new in C99. C++ is based on C90,
so as it stands now, it doesn't have them. TR1 adds them, and that's one
of the parts of TR1 that's been added to the working draft for the next
version of the C++ standard.

But in practice, if your C library supports them, they'll work in C++, too.
 
Reply With Quote
 
 
 
 
P.J. Plauger
Guest
Posts: n/a
 
      07-21-2006
"Pete Becker" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ...

> John Friedland wrote:
>> 'printf' has a '%a' conversion for floating-point output:
>>

>
> The %a and %A conversion specifiers are new in C99. C++ is based on C90,
> so as it stands now, it doesn't have them. TR1 adds them, and that's one
> of the parts of TR1 that's been added to the working draft for the next
> version of the C++ standard.
>
> But in practice, if your C library supports them, they'll work in C++,
> too.


Right. Our current product, which includes full TR1 support, also provides
the manipulator hexfloat, so you can insert hexadecimal format
floating-point
values into a stream. As Pete says, both %a in printf and hexfloat in
iostreams are part of TR1 and will be part of the next C++ Standard.

P.J. Plauger
Dinkumware, Ltd.
http://www.dinkumware.com


 
Reply With Quote
 
P.J. Plauger
Guest
Posts: n/a
 
      07-21-2006
"Pete Becker" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ...

> John Friedland wrote:
>> 'printf' has a '%a' conversion for floating-point output:
>>

>
> The %a and %A conversion specifiers are new in C99. C++ is based on C90,
> so as it stands now, it doesn't have them. TR1 adds them, and that's one
> of the parts of TR1 that's been added to the working draft for the next
> version of the C++ standard.
>
> But in practice, if your C library supports them, they'll work in C++,
> too.


Right. Our current product, which includes full TR1 support, also provides
the manipulator hexfloat, so you can insert hexadecimal format
floating-point
values into a stream. As Pete says, both %a in printf and hexfloat in
iostreams are part of TR1 and will be part of the next C++ Standard.

P.J. Plauger
Dinkumware, Ltd.
http://www.dinkumware.com



 
Reply With Quote
 
John Friedland
Guest
Posts: n/a
 
      07-21-2006
Thanks guys -

John

 
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
Stream does not support concurrent IO read or write operations vishnu ASP .Net 0 12-14-2007 08:29 PM
what is the different between byte stream and character stream? dolphin Java 6 03-18-2007 01:58 PM
get stream mode flags from an opened stream Alexander Korsunsky C++ 1 02-17-2007 10:38 AM
How to GET multi-word input from a *file* stream as opposed to a *console* stream? sherifffruitfly@gmail.com C++ 9 04-27-2006 04:14 PM
Doing readline in a thread from a popen4('rsync ...') stream blocks when the stream ends. Rasmusson, Lars Python 1 04-30-2004 08:10 AM



Advertisments