diff --git a/apps/web/src/utils/math.ts b/apps/web/src/utils/math.ts index 263a53ca..7cbc751d 100644 --- a/apps/web/src/utils/math.ts +++ b/apps/web/src/utils/math.ts @@ -166,8 +166,8 @@ function tokenize(input: string): Token[] { numStr += str[i]; i++; } - const value = Number.parseFloat(numStr); - if (Number.isNaN(value)) { + const value = Number(numStr); + if (!Number.isFinite(value)) { throw new Error(`Invalid number: ${numStr}`); } tokens.push({ type: "NUMBER", value });