www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/08/25/01:53:54

Date: Sun, 25 Aug 1996 08:43:52 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Detsoury Ngonvorarath <dngonvo AT ocisi DOT france-telecom DOT fr>
Cc: djgpp AT delorie DOT com
Subject: Re: your mail
In-Reply-To: <9608231041.AA12852@ocisi.france-telecom.fr>
Message-Id: <Pine.SUN.3.91.960825084013.7312C-100000@is>
Mime-Version: 1.0

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.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019