niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » Programming » C++
Does stream I/O support "%a" floating-point format?
Post new topic   Reply to topic Page 1 of 1 [4 Posts] View previous topic :: View next topic
Author Message
John Friedland
*nix forums beginner


Joined: 11 Jul 2006
Posts: 7

PostPosted: Fri Jul 21, 2006 9:26 am    Post subject: Does stream I/O support "%a" floating-point format? Reply with quote

'printf' has a '%a' conversion for floating-point output:

Quote:
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
Back to top
Pete Becker
*nix forums Guru


Joined: 22 Feb 2005
Posts: 682

PostPosted: Fri Jul 21, 2006 11:13 am    Post subject: Re: Does stream I/O support "%a" floating-point format? Reply with quote

John Friedland wrote:
Quote:
'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.
Back to top
P.J. Plauger
*nix forums Guru


Joined: 16 May 2005
Posts: 365

PostPosted: Fri Jul 21, 2006 11:52 am    Post subject: Re: Does stream I/O support "%a" floating-point format? Reply with quote

"Pete Becker" <petebecker@acm.org> wrote in message
news:Jradnc6FS5RsK13ZnZ2dnUVZ_rudnZ2d@giganews.com...

Quote:
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
Back to top
P.J. Plauger
*nix forums Guru


Joined: 16 May 2005
Posts: 365

PostPosted: Fri Jul 21, 2006 11:53 am    Post subject: Re: Does stream I/O support "%a" floating-point format? Reply with quote

"Pete Becker" <petebecker@acm.org> wrote in message
news:Jradnc6FS5RsK13ZnZ2dnUVZ_rudnZ2d@giganews.com...

Quote:
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
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [4 Posts] View previous topic :: View next topic
The time now is Sat Nov 22, 2008 8:32 pm | All times are GMT
navigation Forum index » Programming » C++
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts Install suse from USB without BIOS support vjy04 Suse 0 Tue Jun 24, 2008 8:57 am
No new posts Install suse from USB without BIOS support vjy04 Suse 0 Tue Jun 24, 2008 8:56 am
No new posts Install suse from USB without BIOS support vjy04 Suse 0 Tue Jun 24, 2008 8:56 am
No new posts Install suse from USB without BIOS support vjy04 Suse 0 Tue Jun 24, 2008 8:55 am
No new posts mailq output format bacilko1 Postfix 0 Tue Oct 03, 2006 12:34 pm

Loans | Property for sale in Spain | Credit Card | Mortgages | Mortgage Calculator
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1566s ][ Queries: 16 (0.0773s) ][ GZIP on - Debug on ]