473,320 Members | 2,098 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,320 software developers and data experts.

a simple problem about printf("%10.5f",f)

here is the source code:
#include<stdio.h>
int main()
{
float f;
scanf("%f",&f);
printf("The float is %10.5f\n",f);
return 0;

}
when I input 12345.11111,the output is 12345.11133.
what's wrong with it?
I compile it with vc++6.0.

Feb 17 '06 #1
10 3762
"Jude" <ja*******@lianluo.com> writes:
here is the source code:
#include<stdio.h>
int main()
{
float f;
scanf("%f",&f);
printf("The float is %10.5f\n",f);
return 0;

}


See the followup I posted to the other copy of this question, posted
three minutes earlier.

Is there something about the Google interface that encourages this
kind of rapid re-posting?

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Feb 17 '06 #2
Keith Thompson <ks***@mib.org> writes:
"Jude" <ja*******@lianluo.com> writes:
here is the source code:
#include<stdio.h>
int main()
{
float f;
scanf("%f",&f);
printf("The float is %10.5f\n",f);
return 0;

}


See the followup I posted to the other copy of this question, posted
three minutes earlier.

Is there something about the Google interface that encourages this
kind of rapid re-posting?


I just noticed that your second posting corrected some errors in the
first (including one that I had pointed out in my followup).

In the future, if you need to correct an error, post a followup in the
same thread rather than starting a new one. If you tried to cancel
the first posting, be aware that cancelling an article rarely works.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Feb 17 '06 #3
Keith Thompson wrote:
"Jude" <ja*******@lianluo.com> writes:
here is the source code:
#include<stdio.h>
int main()
{
float f;
scanf("%f",&f);
printf("The float is %10.5f\n",f);
return 0;

}


See the followup I posted to the other copy of this question, posted
three minutes earlier.

Is there something about the Google interface that encourages this
kind of rapid re-posting?


I suppose this is a rethoric question but anyway...

I think it has nothing to do with google's interface (which btw is not
that bad once you get to know how to use it). But it has to do with how
usenet works and how most people using google interface don't know
about it. After you post a message using google groups there appears a
screen saying "Your message will momentarily appear in <list of groups>
.. Click to continue." My guess is that most newcomers simply don't read
the message, and when they get back to the group and don't see their
brand new post the re-post it again.

Google groups had some glitches in the past (and still has some from
time to time) but there's nothing in it to encourage people to post the
same questions more than once.

Feb 17 '06 #4
I'm sorry .I thought that I had deleted the first post,and I couldn't
see it after deleting it.
In the options,I chose the del option and I remember clearly I choose
the option "Yes,remove it now".
why the first post comes again?

Feb 17 '06 #5
Now, I know the reason. Before I found my error and decided to delete
my post,you had posted your answers. I didn't refresh my page, so I
didn't know you had answerd my questions. As you see, the frist post
had been deleted.
whatever, thanks a lot.

Feb 17 '06 #6
Jude wrote:

Now, I know the reason. Before I found my error and decided to delete
my post,you had posted your answers. I didn't refresh my page, so I
didn't know you had answerd my questions. As you see, the frist post
had been deleted.
whatever, thanks a lot.


No, we can't see. Google is not Usenet. Google is only a highly
flawed insipid interface to usenet. Most usenet users cannot see,
and may never have received, any previous messages. What you
deleted affects nothing. Every message should include adequate
context, and must stand entirely by itself. See my sig below and
the references therein. Then do your best to follow the long
established (30 years or so) usenet posting conventions.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>
Also see <http://www.safalra.com/special/googlegroupsreply/>
Feb 17 '06 #7
Jude wrote:
Now, I know the reason. Before I found my error and decided to delete
my post,you had posted your answers. I didn't refresh my page, so I
didn't know you had answerd my questions. As you see, the frist post
had been deleted.
whatever, thanks a lot.


No, that's not the reason. I can still see both messages. The problem
is that you believe that this is a Google Group, and that all messages
reside in some central place where they can be "deleted". All you did
was remove it from the Google archives, it was still sent flashing
around the world to numerous usenet servers.

Also, read the information below.

Brian

--
Please quote enough of the previous message for context. To do so from
Google, click "show options" and use the Reply shown in the expanded
header.
Feb 17 '06 #8
Jude wrote:
here is the source code:
#include<stdio.h>
int main()
{
float f;
scanf("%f",&f);
printf("The float is %10.5f\n",f);
return 0;

}
when I input 12345.11111,the output is 12345.11133.
what's wrong with it?
I compile it with vc++6.0.

The float doesn't have the precision you seem to require. All the data
in the float is "1.23451113e+04". A double "1.2345111110000000e+04" ?

--
Joe Wright
"Everything should be made as simple as possible, but not simpler."
--- Albert Einstein ---
Feb 17 '06 #9
"Jude" <ja*******@lianluo.com> writes:
Now, I know the reason. Before I found my error and decided to delete
my post,you had posted your answers. I didn't refresh my page, so I
didn't know you had answerd my questions. As you see, the frist post
had been deleted.
whatever, thanks a lot.


I don't know what Google's "delete" button does. My guess is that it
deletes it from Google's archive and sends a "cancel" message. A
"cancel" message is a control message that requests that a specified
message be deleted. It is effective only to the extent that (a) it
propagates to all the sites to which the original message propagated,
and (b) those sites choose to honor "cancel" messages. (Cancels have
been abused in the past, so some sites deliberately ignore them.)

It doesn't hurt to cancel a message that needs to be corrected, but
you should *not* assume that it will do any good. It's usually better
to leave it out there and post any corrections as a followup.

Google is giving you a distorted view of Usenet.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Feb 17 '06 #10
On 2006-02-17, Keith Thompson <ks***@mib.org> wrote:
"Jude" <ja*******@lianluo.com> writes:
Now, I know the reason. Before I found my error and decided to delete
my post,you had posted your answers. I didn't refresh my page, so I
didn't know you had answerd my questions. As you see, the frist post
had been deleted.
whatever, thanks a lot.


I don't know what Google's "delete" button does. My guess is that it
deletes it from Google's archive and sends a "cancel" message. A
"cancel" message is a control message that requests that a specified
message be deleted. It is effective only to the extent that (a) it
propagates to all the sites to which the original message propagated,
and (b) those sites choose to honor "cancel" messages. (Cancels have
been abused in the past, so some sites deliberately ignore them.)

It doesn't hurt to cancel a message that needs to be corrected, but
you should *not* assume that it will do any good. It's usually better
to leave it out there and post any corrections as a followup.

Google is giving you a distorted view of Usenet.


I read his statement as being that it was no longer on the main page of
the thread [i.e. you have to click to show older messages] - more
analogous to expiry than cancellation.
Feb 17 '06 #11

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

Similar topics

11
by: tigervamp | last post by:
I purchased "Pointers on C" online and just received the book. The pages look like they have been poorly photocopied, not the quality I would expect from a $73 book. My question is, to those that...
81
by: Matt | last post by:
I have 2 questions: 1. strlen returns an unsigned (size_t) quantity. Why is an unsigned value more approprate than a signed value? Why is unsighned value less appropriate? 2. Would there...
3
by: Lampa Dario | last post by:
Hello, I hope I am not too OT. How do I write printf("Content-type:%s\r\n\r\n",type) in Pascal ? I am translating a library of mine written in C into Pascal. How do I write \r\n\r\n in...
2
by: Jude | last post by:
here is the source code: #include<stdio.h> int main() { float f; scanf("%d%f",&f); printf("The float is %10.5f\n",f); return 0; } when I input 12345.11111,the output is 12345.11133.
19
by: v4vijayakumar | last post by:
why the following statement dumps the core(Segmentation fault)? printf("%s\n", __FILE__);
12
by: Zero | last post by:
Hi everybody, i want to write a small program, which shows me the biggest and smallest number in dependance of the data type. For int the command could be: ...
51
by: Spidey | last post by:
for(;0;) printf("hello"); even the condition s wrong i get a hello printed on the screen y s this happening
6
by: shuaishuaiyes | last post by:
Hello everyone... I'm a Chinese student and my English is very poor...So excuse me if I make grammar mistake. I want to ask some questions about "rename". I'm a beginner, so my C ..... :) I...
29
by: candy_init | last post by:
Hi all, I just came across the following program: #include <stdio.h> int main() { float a = 12.5; printf("%d\n", a); printf("%d\n", *(int *)&a); return 0;
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
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...
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: 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...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
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: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.