lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Laimonas Simutis <lai...@gmail.com>
Subject TestTieBreaker failing test
Date Wed, 27 May 2015 02:00:16 GMT
Hello,

I am running into an issue in Lucene.net with what seems to be a floating
point number comparison inconsistency. Looking for anyone's guidance or
suggestions.

Here is the offending code:

https://github.com/apache/lucenenet/blob/master/src/Lucene.Net.Core/Search/FuzzyTermsEnum.cs#L243

This conditional evaluation specifically:

termAfter ? Bottom >= CalculateMaxBoost(MaxEdits) : Bottom >
CalculateMaxBoost(MaxEdits)

There is a code path where termAfter is false, so Bottom >
CalculateMaxBoost(MaxEdits) evaluation runs. The evaluation for what looks
like two equal numbers returns Bottom as being greater.
The way I captured this is that I pushed another branch which emits the
values of these numbers, and here is what I see:

termAfter=False, Bottom=0.8571429, maxBoost:0.8571429, yet maxEdits is
substracted....

What makes this worse, I can't reproduce it locally. Also if you change the
logic to evaluate differently (precalculate max boost), it goes away on TC
(almost always :)). There is no random components involved as far as I can
tell. The same numbers / data is executed in Lucene.Net and Lucene versions
of the test.

Here is the failing test that suffers from this on TC:

http://teamcity.codebetter.com/viewLog.html?tab=buildLog&logTab=tree&filter=debug&expand=all&buildId=191414#_focus=6322

Also, this issue goes away in Debug builds, even on TC.

Anyone have any suggestions how to proceed? Not sure what else to try.
Would it be a terrible idea to choose double over float here for better
accuracy, if it is some sort of rounding issue?


Laimis

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message