Download the PHP package ktsirangelos/math-functions without Composer
On this page you can find all versions of the php package ktsirangelos/math-functions. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ktsirangelos/math-functions
More information about ktsirangelos/math-functions
Files in ktsirangelos/math-functions
Package math-functions
Short Description A set of integer-based mathematical operations (divisors, factorials, prime numbers) with XML formatting support for presenting calculation results.
License MIT
Informations about the package math-functions
MathFunctions
The MathFunctions package provides a set of classes for performing various integer-based mathematical operations. It includes functionalities for calculating divisors, factorials, and identifying prime numbers within an array of integers. Additionally, it offers XML formatting for presenting calculation results.
Table of Contents
- Requirements
- Installation
- Running Unit Tests
- Usage
- Exceptions
- Contributing
- License
Requirements
Installation
Running Unit Tests
To run the unit tests for this library:
-
Clone the GitHub repository
-
Install dependencies
- Execute the tests
Usage
Calculating Divisors
To calculate the positive and negative divisors of an integer (excluding 1 and itself), use the calcDivisors()
method:
Calculating Factorials
To calculate the factorial of an integer, use the calcFactorial()
method:
Identifying Prime Numbers
To find prime numbers within an array of integers and receive the results in XML format, use the calcPrimeNumbers()
method:
Formatting Calculation Results
You can format calculation results into an XML string using the toXML()
method:
Exceptions
The functions may throw exceptions for invalid inputs. Ensure to catch and handle these exceptions appropriately in your code.
Contributing
Contributions are welcome! If you find any issues or have suggestions for improvements, feel free to open an issue or submit a pull request.
License
This package is licensed under the MIT License. See the LICENSE file for details.