Date: Sun, 25 Aug 1996 08:43:52 +0200 (IST) From: Eli Zaretskii To: Detsoury Ngonvorarath Cc: djgpp AT delorie DOT com Subject: Re: your mail In-Reply-To: <9608231041.AA12852@ocisi.france-telecom.fr> Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Fri, 23 Aug 1996, Detsoury Ngonvorarath wrote: > void main(void) > { > printf("%lg\n", sin(1)); > } > > $ gcc -o a01 a01.c -lm > > With djgpp 1.12 under msdos 6.2 : > $ go32 a01 > 0.8414709848079 > > With djgpp 2 under win 95, the output is truncated : > $ go32-v2 a01 > 0.841471 > > What must I do to get the correct result 0.8414709848079 with djgpp 2 ? That's easy. Just say this: printf ("%18.14g\n", sin(1.0)); (Note that you don't need to use `lg' in a printf, `g' is enough.) Morale: if you want to see a certain number of significant digits in a floating-point number, never trust the library to do it for you, always request this explicitly.