Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com content-class: urn:content-classes:message Subject: RE: Strange behavior Date: Mon, 4 Mar 2002 16:26:23 +1100 MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Message-ID: X-MS-Has-Attach: X-MimeOLE: Produced By Microsoft Exchange V6.0.5762.3 X-MS-TNEF-Correlator: Thread-Topic: Strange behavior Thread-Index: AcHDOpnaMrDEMR1oRjyR6Ik1DXHEmgAAj/PA From: "Robert Collins" To: "Chuck Allison" , "Richard R. Malloy" , "Randall R Schulz" Cc: "Ross Smith" , Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id g245RCd17420 Floating point comparisons should _always_ be done via a confidence interval, not bitwise equality. As for determinism, I don't know what the logic circuits look like, so can't and won't comment :}. Rob > -----Original Message----- > From: Chuck Allison [mailto:cda AT freshsources DOT com] > Sent: Monday, March 04, 2002 4:08 PM > To: Richard R. Malloy; Randall R Schulz > Cc: Ross Smith; cygwin AT cygwin DOT com > Subject: Re: Strange behavior > > > That's the point. They're always redued, so in both cases, > the expression 2.0/3.0 is evaluated. How can that be > non-deterministic? > > ----- Original Message ----- > From: "Richard R. Malloy" > To: "Randall R Schulz" > Cc: "Ross Smith" ; "'Chuck Allison'" > ; > Sent: Sunday, March 03, 2002 9:47 PM > Subject: Re: Strange behavior > > > > OK. I'm no IA32 expert can someone explain the following > results. (Do > > the floating point registers use guard bits, randomly initialized > > perhaps?) > > > > bool operator==(const Rational& r1, const Rational& r2) > > { > > double a=r1.toDouble(), b=r2.toDouble(); > > cout << ?== a " << a << " " << ?== b " << b << endl; > > return a == b; > > // return r1.toDouble() == r2.toDouble(); > > /* return ( r1.numerator == r2.numerator && r1.denominator == > > r2.denominator ); */ } -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/