Skip to content

Commit

Permalink
Update cli.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
rouzwelt committed Nov 5, 2024
1 parent cf605b9 commit 5002cdb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -435,12 +435,16 @@ export const handleOppsRecord = (
const sumOfSquaresAvg =
previousRecords.map((v) => (avg - v) ** 2).reduce((a, b) => a + b, 0) /
previousRecords.length;
const stdvsRounup = Math.round(Math.sqrt(sumOfSquaresAvg)); // roundup
// round down to nearest int to be more conservative and avoid float
const stdvsRoundown = Math.floor(Math.sqrt(sumOfSquaresAvg));
// hitting upper bound is totally fine, we only care about hitting lower bound
const stdvsLowerBound = avg - stdvsRoundown;
previousRecords.push(oppCount);
if (previousRecords.length > recordSize) {
previousRecords.splice(0, previousRecords.length - recordSize);
}
return oppCount - stdvsRounup;
// any value <= 0 means the lower bounds were hit
return oppCount - stdvsLowerBound;
};

export const main = async (argv: any, version?: string) => {
Expand Down

0 comments on commit 5002cdb

Please sign in to comment.