www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/05/12/01:43:26

Date: Sat, 12 May 2001 08:42:44 +0300
From: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
Sender: halo1 AT zahav DOT net DOT il
To: Dennis Yelle <dennis51 AT jps DOT net>
Message-Id: <2110-Sat12May2001084244+0300-eliz@is.elta.co.il>
X-Mailer: Emacs 20.6 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.9
CC: djgpp AT delorie DOT com
In-reply-to: <3AFC71C1.D3CDF864@jps.net> (message from Dennis Yelle on Fri, 11
May 2001 16:12:01 -0700)
Subject: Re: cout ignores the last 11 bits of long double
References: <3AFC71C1 DOT D3CDF864 AT jps DOT net>
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> From: Dennis Yelle <dennis51 AT jps DOT net>
> Newsgroups: comp.os.msdos.djgpp
> Date: Fri, 11 May 2001 16:12:01 -0700
> 
> i: 51:
> hex:    3fffb89ba24891f7b800
> cout:   1.4422495703074085238171164746745489537716
> printf: 1.4422495703074085238171164746745489537720
> 
> i: 52:
> hex:    3fffb89ba24891f7b400
> cout:   1.4422495703074083017725115496432408690453
> printf: 1.4422495703074084127948140121588949114080
> -------------------------^^^^^^^^^^^^^^^^^^^^^^^^^
> i: 53:
> hex:    3fffb89ba24891f7b600
> cout:   1.4422495703074085238171164746745489537716
> printf: 1.4422495703074084683059652434167219325900
> -------------------------^^^^^^^^^^^^^^^^^^^^^^^^^
> i: 54:
> hex:    3fffb89ba24891f7b500
> cout:   1.4422495703074085238171164746745489537716
> printf: 1.4422495703074084405503896277878084219990
> -------------------------^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> Notice that the cout result for i: 53 is the same
> as for i: 51, but the printf result is different.
> 
> It looks like cout operator<< ignores the last 11 bits of a 
> long double.

I'm guessing that cout somehow converts the argument to double
internally, which gives only about 16.5 digits of precision.

Anyway, bugs in libtsdc++ should be posted elsewhere.  DJGPP doesn't
maintain that library, only ports it.

- Raw text -


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