This commit is contained in:
Joeri Exelmans 2025-05-09 16:55:18 +02:00
parent 1f2249e75a
commit 63b1aa6238
2 changed files with 4 additions and 4 deletions

View file

@ -2,14 +2,14 @@
export const compareInts = x => y => {
if (typeof(x) !== 'bigint' || typeof(y) !== 'bigint') {
throw new Error(`was only meant to compare bigints! got ${x} and ${y}`);
throw new Error(`was only meant to compare bigints! got ${x} (${typeof(x)}) and ${y} (${typeof(y)})`);
}
return (x < y) ? -1 : (x > y) ? 1 : 0;
};
export const compareDoubles = x => y => {
if (typeof(x) !== 'number' || typeof(y) !== 'number') {
throw new Error(`was only meant to compare numbers! got ${x} and ${y}`);
throw new Error(`was only meant to compare numbers! got ${x} (${typeof(x)}) and ${y} (${typeof(y)})`);
}
return (x < y) ? -1 : (x > y) ? 1 : 0;
};