Comments (2)
Sorry, 正则表达式多打了个符号√。现在好了。请更新最新版本,删除了一个√符号。一直没有关注到有个open issue,今天才看到。。。。不好意思
from rpn.js.
如果算式,减号后面有空格,是不会遇到这个问题的。现在已经修正。
原因是因为-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);
from rpn.js.
Related Issues (1)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rpn.js.