infinity checks on bigint

This commit is contained in:
Evan
2025-03-03 19:21:39 -08:00
parent c1383d76f1
commit 0a482e2e6e
+6
View File
@@ -308,6 +308,12 @@ export function generateID(): GameID {
}
export function toInt(num: number): bigint {
if (num === Infinity) {
return BigInt(Number.MAX_SAFE_INTEGER);
}
if (num === -Infinity) {
return BigInt(Number.MIN_SAFE_INTEGER);
}
return BigInt(Math.floor(num));
}