Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wysaid/simple-arithmetic
A simple class for arithmetic parsing & calculating.
https://github.com/wysaid/simple-arithmetic
arithmetic calc calculator equation-curve parse-equation
Last synced: about 1 month ago
JSON representation
A simple class for arithmetic parsing & calculating.
- Host: GitHub
- URL: https://github.com/wysaid/simple-arithmetic
- Owner: wysaid
- Created: 2016-09-08T11:07:13.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2024-02-22T07:01:13.000Z (9 months ago)
- Last Synced: 2024-02-23T05:35:24.206Z (9 months ago)
- Topics: arithmetic, calc, calculator, equation-curve, parse-equation
- Language: C++
- Homepage: http://arithmetic.wysaid.org
- Size: 4.02 MB
- Stars: 5
- Watchers: 3
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# simple-arithmetic
## c++ version
A tiny & high-performance calculation class without other dependencies.
You can use it simply like:```cpp
string s = "(1+1+1+1) ^ tan(((2+2)+(3-2)) * 0.5)";
ArithmeticExpression expression(s);
if(expression)
{
printf("%s = %g\n", s.c_str(), expression.value());
}
```or with variable `x` and `y`:
```cpp
string s = "cos(x^2) + sin(y)^2";
ArithmeticExpression expression(s);
if(expression)
{
expression.setX(0.8);
expression.setY(1.5);
printf("%s = %g\n", s.c_str(), expression.value());
}
```### How to use
Just add `arithmetic.cpp` & `arithmetic.h` to your project.
### ScreenShot
![Tool](screenshot/screenshot2.png "wysaid")
## javascript version
A simple demo that just draw the equation curve
View it online: [http://arithmetic.wysaid.org](http://arithmetic.wysaid.org "wysaid.org")
### ScreenShot Web
[![Tool](screenshot/screenshot.jpg "wysaid")](http://arithmetic.wysaid.org)