Files
game-scoreboard/src/lib/scoring/round.ts
T
joshuaandClaude Opus 5.5 84dfe6a54b Phase 2: scoring engine with full branch coverage
Pure functions in src/lib/scoring implementing docs/SCORING.md: cell values
(override > judge average), weighted raw totals, raw and placement points
with tie averaging, and competition-ranked standings. Coverage thresholds
are enforced at 100% for the module. Also silences the hydration warning
caused by browser extensions modifying <html>.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 13:33:21 +02:00

8 lines
325 B
TypeScript

/** Rounds to `places` decimals, nudging past float error so 1.005 rounds to 1.01. */
export function round(value: number, places: number): number {
const factor = 10 ** places;
return Math.round((value + Math.sign(value) * Number.EPSILON) * factor) / factor;
}
export const round2 = (value: number) => round(value, 2);