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:[EMAIL PROTECTED]
Sent: Thursday, September 13, 2007 7:34 AM
To: [email protected]
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