refactor(logic): 과도한 수치 호환 보정을 제거한다

Core 수치 상태는 JavaScript와 PostgreSQL의 자연 정밀도를 유지한다. 정수 상태 경계와 절삭, 수입 배분 및 사망자 분할 순서는 보존한다.
This commit is contained in:
2026-08-24 19:17:06 +00:00
parent fc9fa0c9a6
commit 60dcf815ea
32 changed files with 148 additions and 522 deletions
+11 -6
View File
@@ -2,16 +2,21 @@ import { describe, expect, it } from 'vitest';
import { round } from '../src/war/utils.js';
describe('legacy war rounding', () => {
it('matches PHP round() at drifted positive and negative half boundaries', () => {
expect(round(4159.499999999999)).toBe(4160);
expect(round(-4159.499999999999)).toBe(-4160);
expect(round(8719.4999999999945)).toBe(8720);
expect(round(-8719.4999999999945)).toBe(-8720);
describe('war rounding', () => {
it('uses the native number boundary without half-point correction', () => {
expect(round(4159.499999999999)).toBe(4159);
expect(round(-4159.499999999999)).toBe(-4159);
expect(round(8719.4999999999945)).toBe(8719);
expect(round(-8719.4999999999945)).toBe(-8719);
});
it('keeps values meaningfully below a half boundary on the lower integer', () => {
expect(round(4159.499999)).toBe(4159);
expect(round(-4159.499999)).toBe(-4159);
});
it('uses JavaScript semantics at exact half points', () => {
expect(round(1.5)).toBe(2);
expect(round(-1.5)).toBe(-1);
});
});