pimath 0.2.12 → 0.2.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/pimath.js +7 -4
- package/dist/pimath.js.map +1 -1
- package/package.json +2 -2
package/dist/pimath.js
CHANGED
|
@@ -2234,7 +2234,10 @@ var he = E("^", "*", "/", "+", "-"), D = E("^", "*", "/", "+", "-", "%", "sin",
|
|
|
2234
2234
|
});
|
|
2235
2235
|
break;
|
|
2236
2236
|
case w.OPERATION:
|
|
2237
|
-
if (r.length
|
|
2237
|
+
if (n.length === 0 && r.length === 0 && (a === "-" || a === "+") && n.push({
|
|
2238
|
+
token: "0",
|
|
2239
|
+
tokenType: w.COEFFICIENT
|
|
2240
|
+
}), r.length > 0) {
|
|
2238
2241
|
let e = r[r.length - 1];
|
|
2239
2242
|
for (; e.token in this.#n && (this.#n[a].associative === "left" && this.#n[a].precedence <= this.#n[e.token].precedence || this.#n[a].associative === "right" && this.#n[a].precedence < this.#n[e.token].precedence) && (n.push(r.pop() ?? {
|
|
2240
2243
|
token: "",
|
|
@@ -2350,8 +2353,8 @@ var he = E("^", "*", "/", "+", "-"), D = E("^", "*", "/", "+", "-", "%", "sin",
|
|
|
2350
2353
|
if (n === void 0 || e === void 0) throw new S(`The addition values ${n ?? "a"} or ${e ?? "b"} are not defined`);
|
|
2351
2354
|
t.push(n + e);
|
|
2352
2355
|
} else if (n.token === "-") {
|
|
2353
|
-
let e = t.pop(), n = t.pop()
|
|
2354
|
-
if (e === void 0) throw new S(
|
|
2356
|
+
let e = t.pop(), n = t.pop();
|
|
2357
|
+
if (n === void 0 || e === void 0) throw new S(`The subtraction values ${n ?? "a"} or ${e ?? "b"} are not defined`);
|
|
2355
2358
|
t.push(n - e);
|
|
2356
2359
|
} else if (n.token === "%") {
|
|
2357
2360
|
let e = t.pop(), n = t.pop();
|
|
@@ -3134,7 +3137,7 @@ var M = class e {
|
|
|
3134
3137
|
n.push(a.divide(e.monoms[0].coefficient));
|
|
3135
3138
|
} else if (i.token === "^") {
|
|
3136
3139
|
if (e.degree().isStrictlyPositive()) throw new r("Cannot elevate a polynom with another polynom !");
|
|
3137
|
-
if (e.monoms[0].coefficient.
|
|
3140
|
+
if (e.monoms[0].coefficient.isNatural()) n.push(a.pow(e.monoms[0].coefficient.value));
|
|
3138
3141
|
else if (a.monoms.length === 1 && a.monoms[0].coefficient.isOne()) {
|
|
3139
3142
|
for (let t in a.monoms[0].literal) a.monoms[0].literal[t].multiply(e.monoms[0].coefficient);
|
|
3140
3143
|
n.push(a);
|