CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Is there any way to output floating number.

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
cchappyboy



Joined: 03 Dec 2008
Posts: 45

View user's profile Send private message

Is there any way to output floating number.
PostPosted: Wed Mar 02, 2011 6:52 pm     Reply with quote

Hi

I want to output floating number like x=0.0176,
how can i make it?\

if i use
printf("x=%f",x);

it is going to output x=0.17 other then 0.0176

what should i do if i want get the 0.0176 or like 0.176e-1.

Thanks for your help!!!
bkamen



Joined: 07 Jan 2004
Posts: 1615
Location: Central Illinois, USA

View user's profile Send private message

Re: Is there any way to output floating number.
PostPosted: Wed Mar 02, 2011 7:39 pm     Reply with quote

cchappyboy wrote:
Hi

I want to output floating number like x=0.0176,
how can i make it?\

if i use
printf("x=%f",x);

it is going to output x=0.17 other then 0.0176

what should i do if i want get the 0.0176 or like 0.176e-1.


Read the manual carefully.

It shows an example using places and decimal point (like %3.2f) that should do the first of what you want.

cheers,

-Ben
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group