By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,693 Members | 1,132 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,693 IT Pros & Developers. It's quick & easy.

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

P: n/a
'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
Jul 21 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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.
Jul 21 '06 #2

P: n/a
"Pete Becker" <pe********@acm.orgwrote in message
news:Jr******************************@giganews.com ...
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
Jul 21 '06 #3

P: n/a
"Pete Becker" <pe********@acm.orgwrote in message
news:Jr******************************@giganews.com ...
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

Jul 21 '06 #4

P: n/a
Thanks guys -

John

Jul 21 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.