lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Granroth, Neal V." <neal.granr...@thermofisher.com>
Subject RE: [jira] Commented: (LUCENENET-95) Nunite test for Search.TestDisjunctionMaxQuery.TestBooleanOptionalWithTiebreaker
Date Thu, 13 Sep 2007 14:37:58 GMT
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.atlassian.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