Commit 310a12fd authored by Amin Bandali's avatar Amin Bandali

Fix previous commit’s for large fractions

parent bda0ca9e
......@@ -112,14 +112,15 @@ public final class SSR extends CatalystCommand implements Runnable {
corpus, cr.elapsed_time));
p("Calculating corpus stats...");
long ssrs = 0, ssrc = 0, num = 0, den = 0, count = 0;
long ssrs = 0, ssrc = 0, count = 0;
BigFraction avgOfRatios = new BigFraction(0, 1);
for (FileResult fr : cr.file_results)
if (fr.ssr_result != null) { // happens when there are
// errors in analyzeFile
// and it exits early
num = fr.ssr_result.ssr_candidate_count;
den = fr.ssr_result.sig_count;
long
num = fr.ssr_result.ssr_candidate_count,
den = fr.ssr_result.sig_count;
ssrs += den;
ssrc += num;
if (den != 0) {
......@@ -129,15 +130,15 @@ public final class SSR extends CatalystCommand implements Runnable {
}
if (count != 0)
avgOfRatios = avgOfRatios.divide(count);
num = avgOfRatios.getNumeratorAsLong();
den = avgOfRatios.getDenominatorAsLong();
pln(" done");
pln(String.format("SSR candidates: %d/%d (%.2f%%)",
ssrc, ssrs, 100. * ssrc / ssrs));
if (count != 0)
pln(String.format("SSR avg of ratios: %d/%d (%.2f%%)",
num, den, 100. * num / den));
pln(String.format("SSR avg of ratios: %s/%s (%.2f%%)",
avgOfRatios.getNumerator(),
avgOfRatios.getDenominator(),
avgOfRatios.percentageValue()));
cr.ssr_result = new SSRResult();
cr.ssr_result.sig_count = ssrs;
cr.ssr_result.ssr_candidate_count = ssrc;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment