https://github.com/tina-1300/charly
Charly is a modern, powerful and easy-to-use C++ library for handling mathematics.
https://github.com/tina-1300/charly
cpp cpp-programming cpp20 cpp20-library fraction fractions library math mathematica mathematics maths simple static
Last synced: about 1 month ago
JSON representation
Charly is a modern, powerful and easy-to-use C++ library for handling mathematics.
- Host: GitHub
- URL: https://github.com/tina-1300/charly
- Owner: Tina-1300
- License: mit
- Created: 2025-05-22T00:58:45.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2025-06-29T15:42:41.000Z (4 months ago)
- Last Synced: 2025-06-29T16:38:01.089Z (4 months ago)
- Topics: cpp, cpp-programming, cpp20, cpp20-library, fraction, fractions, library, math, mathematica, mathematics, maths, simple, static
- Language: C++
- Homepage:
- Size: 2.69 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README
# Charly
Charly is a modern, powerful and easy-to-use C++ library for handling mathematics.
## Use 🚀
```cpp
#include
#include// g++ -O2 -Wall -Wextra -o test_fraction.exe test_fraction.cpp -lCharly
using namespace Charly;
int main(){
Fraction f1(1, 2); // 1/2
Fraction f2(3, 4); // 3/4
Fraction f3(5, 3); // 5/3
Fraction f4(12, 7); // 12/7Fraction sum = f1 + f2 + f2 - f3 * f2 / f4;
if(f1 == f3){
std::cout << "True" << "\n";
}else{
std::cout << "False" << "\n";
}if(f1 < f2){
std::cout << "True" << "\n";
}if(f1 != f2){
std::cout << "True" << "\n";
}if(f1 <= f2 && f1 <= f1){
std::cout << "True" << "\n";
}if(f2 > f1){
std::cout << "True" << "\n";
}if (f2 >= f1 && f2 >= f2){
std::cout << "True" << "\n";
}std::cout << f1 << "\n";
std::cout << f1.to_decimal() << "\n"; // converting fraction to decimal value
sum.reduction(true); // reduce the fraction
sum.print(); // show resultstd::cin.get(); // wait for a key press to exit
return 0;
}
```