Mail Archives: djgpp/1998/06/18/12:04:33
From: | Erik Max Francis <max AT alcyone DOT com>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Re: float convertion
|
Date: | Thu, 18 Jun 1998 08:44:21 -0700
|
Organization: | Alcyone Systems
|
Lines: | 20
|
Message-ID: | <358935D5.1C6F0E88@alcyone.com>
|
References: | <3588A620 DOT 1CFB AT dillinger DOT de>
|
NNTP-Posting-Host: | charmaine.alcyone.com
|
Mime-Version: | 1.0
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Michael Hecht wrote:
> float f = 3.14159;
> double d = 3.1415926543;
> char sf[256]; /* this should be enough */
> char sd[256]; /* this should be enough */
>
> sprintf(sf,"%.6f",f);
> sprintf(sd,"%.8lf",d);
Actually, the format specifier in the ...printf routines is %f for both
floats and doubles. It's the ...scanf family in which they differ.
--
Erik Max Francis, &tSftDotIotE / mailto:max AT alcyone DOT com
Alcyone Systems / http://www.alcyone.com/max/
San Jose, California, United States / icbm:+37.20.07/-121.53.38
\
She glanced at her watch / . . . It was 9:23.
/ James Clavell
- Raw text -