pimath 0.2.13 → 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 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 > 0) {
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() ?? 0;
2354
- if (e === void 0) throw new S("The subtraction value b is not defined");
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();