1.0.0 • Published 5 months ago
simp-math v1.0.0
Simp-Math is a lightweight TypeScript math utility library that provides basic arithmetic operations. It includes functions for addition, subtraction, multiplication, and exponentiation.
Features
- Addition: Add two numbers.
- Subtraction: Subtract the second number from the first.
- Multiplication: Multiply two numbers.
- Exponentiation: Raise a number to the power of another.
Installation
You can install the library via npm:
npm install simp-math
Note: Adjust the package name as necessary if publishing to a package registry.
Usage
Import the functions in your TypeScript or JavaScript project:
import { add, subtract, multiply, power } from 'simp-math';
// Examples:
const sum = add(3, 5); // 8
const diff = subtract(10, 4); // 6
const product = multiply(7, 6); // 42
const result = power(2, 3); // 8
API
add(a: number, b: number): number
Adds two numbers.
- Parameters:
a
- The first number.b
- The second number.
- Returns: The sum of
a
andb
.
subtract(a: number, b: number): number
Subtracts the second number from the first.
- Parameters:
a
- The first number.b
- The second number.
- Returns: The difference between
a
andb
.
multiply(a: number, b: number): number
Multiplies two numbers.
- Parameters:
a
- The first number.b
- The second number.
- Returns: The product of
a
andb
.
power(base: number, exponent: number): number
Raises a number to the power of another.
- Parameters:
base
- The base number.exponent
- The exponent.
- Returns: The result of raising
base
to theexponent
.
License
This project is licensed under the MIT License. `
1.0.0
5 months ago