mega-math
v1.0.1
Published
A comprehensive math utilities library for advanced mathematical operations, including matrix calculations, prime number checks, factorials, and financial formulas like compound interest and EMI calculators.
Readme
@brang/mega-math
A simple and powerful library for performing basic mathematical operations.
Features
- Addition, subtraction, multiplication, and division functions.
- Lightweight and easy to use.
- Written in TypeScript for type safety.
Installation
You can install the package via npm or yarn:
Using npm
npm install mega-mathUsing yarn
yarn add mega-mathUsage
Here’s how to use the library:
Importing the functions
import { add, subtract, multiply, divide } from "mega-math";
// Perform addition
const sum = add(5, 10); // 15
// Perform subtraction
const difference = subtract(10, 5); // 5
// Perform multiplication
const product = multiply(5, 10); // 50
// Perform division
const quotient = divide(10, 5); // 2TypeScript Support
Since the package is written in TypeScript, it includes type definitions for all the functions:
import { add } from "mega-math";
const sum: number = add(5, 10); // Works perfectly with TypeScript!API Reference
add(a: number, b: number): number
Adds two numbers.
subtract(a: number, b: number): number
Subtracts the second number from the first.
multiply(a: number, b: number): number
Multiplies two numbers.
divide(a: number, b: number): number
Divides the first number by the second. Throws an error if the divisor is 0.
Contributing
We welcome contributions! To contribute:
- Fork the repository.
- Create a new branch (
git checkout -b feature-name). - Commit your changes (
git commit -m 'Add feature'). - Push to the branch (
git push origin feature-name). - Open a pull request.
License
This project is licensed under the MIT License. See the LICENSE file for details.
