Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/timhaj/math
A math library for all math operations
https://github.com/timhaj/math
Last synced: 8 days ago
JSON representation
A math library for all math operations
- Host: GitHub
- URL: https://github.com/timhaj/math
- Owner: timhaj
- Created: 2024-05-02T16:30:01.000Z (8 months ago)
- Default Branch: master
- Last Pushed: 2024-08-05T19:18:02.000Z (5 months ago)
- Last Synced: 2024-11-08T09:44:03.557Z (2 months ago)
- Language: C++
- Homepage:
- Size: 855 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# maTH
Ongoing C++ library which covers a wide range of math operations and keeps growing to offer more tools for all sorts of calculations.You can find the full in-depth documentation [here:](https://math-5.gitbook.io/math/)
Here's a short demo to use the library:
```cpp
//
#include "maTH.h"
#include
using namespace std;int main() {
int a = 10, b = 5;
float x = 5.1, y = 2;
cout << factorial(b) << endl; // 120
cout << PI << endl; // you can directly use constants
cout << "Addition: " << add(a, x) << endl; // 15
cout << "Addition: " << add(a, x) << endl; // 15.1
return 0;
}
```
to run the code, run the following command with the library:
```console
g++ -L. -lmaTH -o main_executable
```
and run the executable using ```./main_executable``` or ```main_executable.exe```Don't have g++ compiler installed? [Check the installation guide here](https://code.visualstudio.com/docs/cpp/config-mingw)
___Incase you're changing the code and the included library doesn't work anymore, compile the source code to an object file with:
```console
g++ -c maTH.cpp -o maTH.o
```
and create the library with:
```console
ar rcs libmaTH.a maTH.o
```## CMake instructions
```cmd
mkdir build
cd build
cmake ..
make
main
```
Incase the Makefile doesn't appear, use:
```cmd
mkdir build
cd build
cmake -G "Unix Makefiles" ..
make
main
```## Contributions
Contributions for the library are very much welcome! If you have ideas for new features, optimizations, or bug fixes, feel free to open an issue or submit a pull request.
___
TODO:
- gitbook docs, more detail for constants
- more math!, maybe DS&algos in future