We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
console.log(rpn.calculate('5-2'));
Uncaught TypeError: calcStack.pop(...).toFixed is not a function at Object.rpnCalculate (rpn.js:149:37) at Object.calculate (rpn.js:158:24) ....
The text was updated successfully, but these errors were encountered:
Sorry, 正则表达式多打了个符号√。现在好了。请更新最新版本,删除了一个√符号。一直没有关注到有个open issue,今天才看到。。。。不好意思
Sorry, something went wrong.
如果算式,减号后面有空格,是不会遇到这个问题的。现在已经修正。 原因是因为-2有时候要理解成 “负2”, 有时候要理解成“减2”,如果减号前面是个数字,百分号和阶乘号,那说明它是个“减” 如果减号前面是其它运算符号,那它就是“负” 。 其它符号没有这个转换问题,Unit test里没有使用减法。。。所以。。。。 现在增加了三行减法UT
expect(rpn.rpnCalculate(rpn.infix2rpn('5-1'))).equal(4); expect(rpn.rpnCalculate(rpn.infix2rpn('5+ -2'))).equal(3); expect(rpn.rpnCalculate(rpn.infix2rpn('5--2'))).equal(7);
No branches or pull requests
console.log(rpn.calculate('5-2'));
Uncaught TypeError: calcStack.pop(...).toFixed is not a function
at Object.rpnCalculate (rpn.js:149:37)
at Object.calculate (rpn.js:158:24)
....
The text was updated successfully, but these errors were encountered: