Sender: hecht AT DH_NRZ24 DOT dillinger DOT de Message-ID: <3588A620.1CFB@dillinger.de> Date: Thu, 18 Jun 1998 08:31:12 +0300 From: Michael Hecht MIME-Version: 1.0 To: jonathan DOT villani AT videotron DOT ca CC: djgpp AT delorie DOT com Subject: Re: float convertion Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Precedence: bulk Try this one: #include int main() { float f = 3.14159; /* i'm not sure about the right value */ double d = 3.1415926543; /* i'm not sure about the right value */ char sf[256]; /* this should be enough */ char sd[256]; /* this should be enough */ sprintf(sf,"%.6f",f); sprintf(sd,"%.8lf",d); printf("\nresult is: %.6f = '%s' , %.8lf = '%s'\n",f,sf,d,sd); return 0; } result is: 3.141590 = '3.141590' , 3.14159265 = '3.14159265'