delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/03/06/03:28:14

X-Spam-Check-By: sourceware.org
Subject: Re: Precision of doubles and stdio
In-Reply-To: From Roberto Bagnara at "Mar 5, 2006 12:44:18 pm"
From: Jim Easton <jim AT cs DOT ualberta DOT ca>
To: Roberto Bagnara <bagnara AT cs DOT unipr DOT it>
Date: Mon, 6 Mar 2006 01:27:51 -0700 (MST)
CC: cygwin AT cygwin DOT com, Jim Easton <jim AT cs DOT ualberta DOT ca>
Message-Id: <S557523AbWCFI1v/20060306082754Z+38@sunkay.cs.ualberta.ca>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Dear Mr. Bagnara,

Roberto Bagnara wrote: 
...
> does this on Linux/i686
> 
> $ a.out
> 70.9
> 70.900000000000005684341886080801486968994140625
> 
> and does the following under Cygwin on the same machine:
...
> $ ./a.exe
> 70.9
> 70.90000000000000568434188608080148696899414
> 
> Why?  Is there a way to reconcile the two behaviors?
> Notice that I know about the x87 and its vaguaries:
> nonetheless I wonder why such a scanf immediately
> followed by a printf shows a difference between
> Cygwin and Linux.

With all due respect, why would you want to?  With double you are
guaranteed only 16 or so digits - the rest is noise.  Frankly I am
amazed that it agrees as far as it does.

	Jim


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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