473,326 Members | 2,438 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

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

'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
4 2133
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
"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
"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
Thanks guys -

John

Jul 21 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Steven T. Hatton | last post by:
I've seen people here write that C++ doesn't support modules. What does that mean? 'Module' is a very nebulous term in my book. It probably means something quite different to me than what it does...
2
by: Bob Rock | last post by:
I already found an alternative way to accomplish this (using ReadBytes), still I'd like to understand why I'm getting and error reading a text file using the following method. The exception is...
1
by: Michael Stock | last post by:
Hi all, hopefully someone can tell me how to do this for a web server in C#: We have images in a folder you can't access over the net. So everytime we need to display an image from this folder,...
2
by: CVerma | last post by:
I'm using an html input control (System.web.UI.HTMLControls.HTMLInputFile) to upload files such as msword, excel, jpg, and pdf. I have the encType property set in the form:...
6
by: Tom Kaminski [MVP] | last post by:
I can do this in ASP, but not sure how to handle in ASP.NET: How To Use the ADODB.Stream Object to Send Binary Files to the Browser through ASP http://support.microsoft.com/?kbid=276488 Do I...
51
by: Tony Sinclair | last post by:
I'm just learning C#. I'm writing a program (using Visual C# 2005 on WinXP) to combine several files into one (HKSplit is a popular freeware program that does this, but it requires all input and...
5
by: chandanlinster | last post by:
When I was reading the man-page of fflush, I came across this statement --- "The function fflush forces a write of all user-space buffered data for the given output or update stream via the...
6
by: William | last post by:
for example, I have a global object: extern Object myobj; Can gcc get this object by using string "myobj" at runtime?? I know C++ rtti doesnt support this, but I dont know if gcc can , ...
4
by: =?utf-8?B?Qm9yaXMgRHXFoWVr?= | last post by:
Hello, (sorry to begin with Java in a Python list ;-) in Java, when I want to pass input to a function, I pass "InputStream", which is a base class of any input stream. In Python, I found...
0
by: Gabriel Genellina | last post by:
En Thu, 25 Sep 2008 09:49:31 -0300, Almar Klein <almar.klein@gmail.com> escribió: Use subprocess.PIPE Usually the tricky part is to figure out exactly whether there is more input or not. With...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.