Fixed issue where fisher would return '-nan' or 'nan' in different environments by making explicit test for NaN and using '-nan' (as epected by the test script)
@@ -85,8 +85,17 @@ void Fisher::giveFinalReport(RecordOutputMgr *outputMgr)
printf("# p-values for fisher's exact test\n");
printf("left\tright\ttwo-tail\tratio\n");
+
+ /* Some implementations report NAN as negative, some as positive. To ensure
+ * we get consistent output from each compiler, we should do our own test.
+ * Since the test script assumes "-nan", let's setle on that.
+ */
+ if(std::isnan(ratio)) {
+ printf("%.5g\t%.5g\t%.5g\t-nan\n", left, right, two);
+ } else {
printf("%.5g\t%.5g\t%.5g\t%.3f\n", left, right, two, ratio);
}
+}
unsigned long Fisher::getTotalIntersection(RecordKeyVector &recList)
{
