mirror of
https://github.com/Horizontal42/summarum.git
synced 2026-11-10 22:41:58 +03:00
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:
parent
deea37ba21
commit
ef6244dc84
2 changed files with 9 additions and 1 deletions
|
|
@ -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");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -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",
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue