exp() silently evaluated as a no-op

"exp" was also listed as a scientific-notation alias ("123456 in
exp"). Phrases register first-come-first-served, and that alias was
registered before the exp() function, so the function itself never
got the phrase — exp(1) parsed as a bare (1) and returned 1. Drop
exp from the scientific-notation aliases; sci/exponent/exponential
still work.
This commit is contained in:
Horizontal42 2026-07-03 11:25:29 +03:00
parent deea37ba21
commit ef6244dc84
2 changed files with 9 additions and 1 deletions

View file

@ -224,4 +224,12 @@ describe("review fixes", () => {
expect(calc("$12 * 3")).toBe("$36"); expect(calc("$12 * 3")).toBe("$36");
expect(calc("2 m * 3 m")).toBe("6 m²"); expect(calc("2 m * 3 m")).toBe("6 m²");
}); });
it("exp(x) is Euler's number to the power x, not scientific notation", () => {
expect(calc("exp(1)")).toBe("2.72");
expect(calc("exp(0)")).toBe("1");
});
it("scientific notation still works via sci/exponent/exponential", () => {
expect(calc("123456 in scientific")).toBe("1.23e5");
expect(calc("123456 in exponent")).toBe("1.23e5");
});
}); });

View file

@ -410,7 +410,7 @@ export const EN: VocabLocale = {
"decimal.variants": "decimal,dec", "decimal.variants": "decimal,dec",
"hex.variants": "hex", "hex.variants": "hex",
"octal.variants": "octal", "octal.variants": "octal",
"scientific.variants": "scientific, sci, exp, exponent, exponential" "scientific.variants": "scientific, sci, exponent, exponential"
}, },
"Operations": { "Operations": {
"assignment.variants": "equal,is", "assignment.variants": "equal,is",