473,699 Members | 2,539 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

printf format for double

Is it possible to print a float or double in exponential form with a 0
before the decimal point?

E.g. 0.1234567E+00 rather than 1.2345670E-01 (using %14.7E) ? As far as I
understand the format specifies in n1256, this isn't possible, is it?

Bye, Jojo
Oct 2 '07 #1
1 2438
"Joachim Schmitz" <no*********@sc hmitz-digital.dewrite s:
Is it possible to print a float or double in exponential form with a 0
before the decimal point?
No, there is no way to convince printf to do that. You could
post-process sprintf's output into that format, though.
--
"I hope, some day, to learn to read.
It seems to be even harder than writing."
--Richard Heathfield
Oct 2 '07 #2

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

Similar topics

2
3504
by: Paul E Johnson | last post by:
Dear friends in C: I'm completely baffled by this problem I have with printf statements and conditional operators in C. I'm using gcc-3.3. I have a project where the rarely used Union type is called for! Incredible, but true. union mixed
5
2584
by: Peter Ammon | last post by:
It's my understanding that the printf() function is declared as int printf(const char * restrict format, ...); in stdio.h. And loosely speaking, if a parameter is declared as restricted, then accesses to the object must go through that parameter. Does this mean that printf("%s", "%s");
3
3221
by: Hans Ginzel | last post by:
Hello, let us consider function int foo(char *name, void *data) { ... printf(name, data); /* Should be *data? */ ... }
7
2552
by: sunfiresg | last post by:
During an interview, I am asked to answer a question: Printf is a major formatted output function provided by the standard C library. Printf accepts a formatting string followed by a various number of arguments to replace formatting specifiers in the formatting string. You should implement the subset of the printf function compliant to the following specification.
7
96306
by: teachtiro | last post by:
Hi, 'C' says \ is the escape character to be used when characters are to be interpreted in an uncommon sense, e.g. \t usage in printf(), but for printing % through printf(), i have read that %% should be used. Wouldn't it have been better (from design perspective) if the same escape character had been used in this case too. Forgive me for posting without verfying things with any standard compiler, i don't have the means for now.
15
1660
by: Michael B Allen | last post by:
I'm printing tables of structure members in a terminal and I would like to use printf with an arbitrary pointer so that the code is smaller and I don't need to switch over ever possible type. But the question is - can I pass an arbitrary type (short, double, char *, etc) to printf cast as a char * (provided the specified format string is appropriate of course)? I chose 'char *' because I reasoned it (a pointer) would large enough to...
17
2503
by: arindam.mukerjee | last post by:
I was running code like: #include <stdio.h> int main() { printf("%f\n", 9/5); return 0; }
4
1368
by: estantep | last post by:
Has anybody ever seen a thing like this? ### code: double link_bw_cost(int a, int b){ double ro; ro = ( (double) link_usage.bandw / (double) link.bandw);
6
16734
by: RoS | last post by:
the format for conversion of double in the function printf is "%f" or "%lf" or both? for example printf("%f", (double)0.0); printf("%lf", (double)0.0); are both ok? Good morning Thank you
3
2613
by: google | last post by:
Consider the following code: char str; char str2; strcpy(str, "%alfa% %beta% d%100%d %gamma% %delta%"); printf("printf: "); printf("1%s2", str); printf("\nsprintf: "); sprintf(str2, "1%s2", str); //Interesting stuff happens here printf(str2);
0
8615
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9034
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8883
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7750
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4376
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4629
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3057
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2347
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2009
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.