lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "George Aroush" <geo...@aroush.net>
Subject RE: [jira] Commented: (LUCENENET-95) Nunite test for Search.TestDisjunctionMaxQuery.TestBooleanOptionalWithTiebreaker
Date Thu, 13 Sep 2007 15:10:31 GMT
In my case, optimized or debugged, I always get 'false' and -2.235174E-08
for "Console.WriteLine("Diff: " + (f2-fn))".

I really find it hard to believe that the output will different for
optimized and debug code for such a case.  This is such an easy case to slip
past QA.

-- George


> -----Original Message-----
> From: Granroth, Neal V. [mailto:neal.granroth@thermofisher.com] 
> Sent: Thursday, September 13, 2007 10:38 AM
> To: lucene-net-dev@incubator.apache.org
> Subject: RE: [jira] Commented: (LUCENENET-95) Nunite test for 
> Search.TestDisjunctionMaxQuery.TestBooleanOptionalWithTiebreaker
> 
> A slight alteration to your example makes it work the same in 
> both release and debug
> 
> static void Main()
> {
>         float f2 = 0.1f;
>         float fn = f2;
> 
>         fn += 1;
>         fn -= 1;
> 
>         Console.WriteLine("Diff: " + (f2-fn));
> 
>         Console.WriteLine("f2==fn -> " + (f2==fn).ToString());
>         fn = f2;
> 
> }
> 
> It seems that there is a problem with the optimization that 
> occurs in release; you have actually use the altered value 
> "fn" for the equality test to work properly.
> 
> -- Neal
> 
> -----Original Message-----
> From: Digy (JIRA) [mailto:jira@apache.org]
> Sent: Thursday, September 13, 2007 7:34 AM
> To: lucene-net-dev@incubator.apache.org
> Subject: [jira] Commented: (LUCENENET-95) Nunite test for 
> Search.TestDisjunctionMaxQuery.TestBooleanOptionalWithTiebreaker
> 
> 
>     [ 
> https://issues.apache.org/jira/browse/LUCENENET-95?page=com.at
lassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12527087 ]
> 
> Digy commented on LUCENENET-95:
> -------------------------------
> 
> I prepared a sample case:
> 
> 
> static void Main()
> {
>         float f2 = 0.1f;
>         float fn = f2;
> 
>         fn += 1;
>         fn -= 1;
> 
>         Console.WriteLine("f2==fn -> " + (f2==fn).ToString());
>         fn = f2;
> }
> 
> 
> 
> it outputs true or false depending on the build type(release or debug)
> 
> 
> Since all numbers can not be stored exactly when using 
> floating point representation,
> (http://www.yoda.arachsys.com/csharp/floatingpoint.html)
> it is safer to apply the SCORE_COMP_THRESH patch
> 
> DIGY
> 
> 


Mime
View raw message