delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/08/04/11:54:31

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
From: "Dave Korn" <dave DOT korn AT artimi DOT com>
To: <cygwin AT cygwin DOT com>
References: <40C7B1BFC291ED4E9D10436D07736A33127AB73CD1 AT EXMAIL7 DOT haas DOT uc DOT berkeley DOT edu>
Subject: RE: cygwin gcc: Different numerical results in thread vs in main()
Date: Mon, 4 Aug 2008 16:53:27 +0100
Message-ID: <01cf01c8f64a$3bfd7be0$9601a8c0@CAM.ARTIMI.COM>
MIME-Version: 1.0
X-Mailer: Microsoft Office Outlook 11
In-Reply-To: <40C7B1BFC291ED4E9D10436D07736A33127AB73CD1@EXMAIL7.haas.uc.berkeley.edu>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
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

Richard Stanton wrote on 04 August 2008 15:29:

> Thanks for the helpful information, David. Oddly, -ffloat-store doesn't
> seem to make any difference: 

  No, unfortunately it can't be assumed to; it'll only come into play if the
results get spilled to memory, rather than living in (x87) registers the
whole time.  It's not a very useful workaround as it only fixes some
instances of the problem and not others, and it does so unpredictably
according to optimisation settings, register pressure and context.  It's
only useful as a very limited diagnostic: in those cases where it /does/
make a difference, you can be pretty certain that excess precision is coming
into play, but in those where it makes no difference, you just still don't
know.

  Take a look at the (legendary) GCC PR323:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=323

... and in particular comment #60:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=323#c60

... which has a bit of code you can adapt (google for the definition of
_FPU_SETCW, it's an inline asm you can copy from linux/x86 headers); using
that to set double precision mode in your thread startup code, and using
double (never float) types throughout your code is probably the best you can
do.


    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....


--
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