pimath 0.0.85 → 0.0.88

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/pi.js CHANGED
@@ -4823,7 +4823,13 @@ class NumExp {
4823
4823
  }
4824
4824
  else if (element.token === 'nthrt') {
4825
4825
  // TODO: support nthrt in num. exp.
4826
- // this._addToStack(stack, Math.pow(a, 1/b))
4826
+ let b = stack.pop();
4827
+ if (a % 2 === 0 && b < 0) {
4828
+ this._addToStack(stack, NaN);
4829
+ }
4830
+ else {
4831
+ this._addToStack(stack, (b < 0 ? -1 : 1) * Math.pow(Math.abs(b), 1 / a));
4832
+ }
4827
4833
  }
4828
4834
  else if (element.token === 'ln') {
4829
4835
  this._addToStack(stack, Math.log(a));