diff --git a/README.md b/README.md index 5ba9681..f7e1609 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,72 @@ -# fabelous-math +# Fabelous Math -Python addtional math libary \ No newline at end of file +Fabelous Math is a simple library designed to provide basic mathematical functions, saving you the trouble of writing these common utilities repeatedly. This library includes essential functions like checking if a number is even or odd. + +## Installation + +You can easily install `fabelous-math` using pip: + +```sh +pip install https://gitea.fabelous.app/Fabel/fabelous-math.git +``` + +## Usage + +### Python + +To use the functions provided by Fabelous Math in your Python code, you can import them as follows: + +```python +from fabelous_math import is_even, is_odd + +# Example usage: +number = 42 +print(f"Is {number} even? {is_even(number)}") +print(f"Is {number} odd? {is_odd(number)}") +``` + +## Functions + +### `is_even` + +Checks if a given number is even. + +- **Python:** + ```python + def is_even(number: int) -> bool: + pass + ``` + +- **C++:** + ```cpp + namespace simple_functions { + bool is_even(long long number); + } + ``` + +### `is_odd` + +Checks if a given number is odd. + +- **Python:** + ```python + def is_odd(number: int) -> bool: + pass + ``` + +- **C++:** + ```cpp + namespace simple_functions { + bool is_odd(long long number); + } + ``` +## Performance Comparison + +To understand the performance of `fabelous-math` functions, I conducted a series of tests comparing my methods with traditional modulo operations. Below are the results: + +### Low Numbers Performance: +![Low Numbers Performance](docs/low_numbers_comparison.png) + + +### High Numbers Performance: +![High Numbers Performance](docs/high_numbers_comparison.png) diff --git a/docs/high_numbers_comparison.png b/docs/high_numbers_comparison.png new file mode 100644 index 0000000..3fb7d96 Binary files /dev/null and b/docs/high_numbers_comparison.png differ diff --git a/docs/low_numbers_comparison.png b/docs/low_numbers_comparison.png new file mode 100644 index 0000000..55729bd Binary files /dev/null and b/docs/low_numbers_comparison.png differ diff --git a/example.py b/example.py index ee0f1ff..c9b0ffc 100644 --- a/example.py +++ b/example.py @@ -1,3 +1,4 @@ from fabelous_math import is_even, is_odd -print(is_even(5)) \ No newline at end of file +print(is_even(5)) +print(is_odd(19)) \ No newline at end of file diff --git a/src/fabelous_math/__main__.py b/src/fabelous_math/__main__.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/fabelous_math/cpp/functions/simple_functions.cpp b/src/fabelous_math/cpp/functions/simple_functions.cpp index 6638dae..4d5ecab 100644 --- a/src/fabelous_math/cpp/functions/simple_functions.cpp +++ b/src/fabelous_math/cpp/functions/simple_functions.cpp @@ -2,10 +2,10 @@ namespace simple_functions { bool is_even(long long number) { - return (number & 1) == 0; + return (number & 1) == 0; } bool is_odd(long long number) { - return (number & 1) == 1; + return (number & 1); } } \ No newline at end of file diff --git a/tests/functions/test_simple_functions.py b/tests/functions/test_simple_functions.py deleted file mode 100644 index e69de29..0000000 diff --git a/tests/test__main__.py b/tests/test__main__.py deleted file mode 100644 index e69de29..0000000