npm package: @hero-page/hero-math-functions
Description: A set of mathematical functions for performing basic arithmetic operations, finding the min/max value in an array, and calculating mean, median, and mode
Author: Sam Chahine
Latest version: 1.0.0


_This entire repository was created completely with **AI**, using the [hero-ai-package-creator](https://github.com/hero-page/hero-ai-package-creator), which is **open-source**, uses **GPT-4**, and is written & maintained by [**Sam Chahine**](https://hero.page/samir)_ ❣️🧞‍♀️ 



# hero-math-functions

A set of mathematical functions for performing basic arithmetic operations, finding the min/max value in an array, and calculating mean, median, and mode.

## Functions

### add
Adds two numbers together.

*Test cases:* add(2, 3) returns 5.

*Extreme cases to handle:* very large numbers, very small numbers.

Ignore non-numeric inputs.

### subtract
Subtracts one number from another.

*Test cases:* subtract(7, 4) returns 3.

*Extreme cases to handle:* negative results and very large/small numbers.

Ignore non-numeric inputs.

### multiply
Multiplies two numbers together.

*Test cases:* multiply(3, 5) returns 15.

*Extreme cases to handle:* very large/small numbers and products.

Ignore non-numeric inputs.

### divide
Divides one number by another.

*Test cases:* divide(10, 2) returns 5.

*Extreme cases to handle:* dividing by zero and very large/small numbers.

Ignore non-numeric inputs.

### min
Returns the minimum value in an array.

*Test cases:* min([1, 2, 3]) returns 1.

*Extreme cases to handle:* very large arrays and empty arrays.

Ignore non-numeric values.

### max
Returns the maximum value in an array.

*Test cases:* max([1, 2, 3]) returns 3.

*Extreme cases to handle:* very large arrays and empty arrays.

Ignore non-numeric values.

### mean
Calculates the mean (average) of an array of numbers.

*Test cases:* mean([1, 2, 3]) returns 2.

*Extreme cases to handle:* very large arrays, empty arrays, and arrays with non-numeric values.

Ignore non-numeric values.

### median
Calculates the median (middle) value of an array of numbers.

*Test cases:* median([1, 2, 3]) returns 2.

*Extreme cases to handle:* very large arrays, empty arrays, and arrays with non-numeric values.

Ignore non-numeric values.

### mode
Calculates the mode (most frequent) value in an array of numbers.

*Test cases:* mode([1, 2, 2, 3]) returns 2.

*Extreme cases to handle:* very large arrays, empty arrays, and arrays with non-numeric values.

Ignore non-numeric values.

### abs
Returns the absolute value of a number.

*Test cases:* abs(-5) returns 5.

*Extreme cases to handle:* very large/small numbers.

Ignore non-numeric inputs.

### square
Squares a number.

*Test cases:* square(4) returns 16.

*Extreme cases to handle:* very large/small numbers.

Ignore non-numeric inputs.

### squareRoot
Returns the square root of a number.

*Test cases:* squareRoot(9) returns 3.

*Extreme cases to handle:* negative inputs and very large/small numbers.

Ignore non-numeric inputs.

### power
Raises a number to the given exponent.

*Test cases:* power(2, 3) returns 8.

*Extreme cases to handle:* very large/small numbers and exponents.

Ignore non-numeric inputs.

### round
Rounds a number to the nearest integer.

*Test cases:* round(3.5) returns 4.

*Extreme cases to handle:* very large/small numbers.

Ignore non-numeric inputs.

### ceil
Rounds a number up to the nearest integer.

*Test cases:* ceil(3.2) returns 4.

*Extreme cases to handle:* very large/small numbers.

Ignore non-numeric inputs.

### floor
Rounds a number down to the nearest integer.

*Test cases:* floor(3.7) returns 3.

*Extreme cases to handle:* very large/small numbers.

Ignore non-numeric inputs.

### trunc
Truncates (removes the decimal) a number.

*Test cases:* trunc(3.7) returns 3.

*Extreme cases to handle:* very large/small numbers.

Ignore non-numeric inputs.

### gcd
Finds the greatest common divisor (GCD) of two numbers.

*Test cases:* gcd(5, 10) returns 5.

*Extreme cases to handle:* very large/small numbers and negative inputs.

Ignore non-numeric inputs.

### lcm
Finds the least common multiple (LCM) of two numbers.

*Test cases:* lcm(3, 5) returns 15.

*Extreme cases to handle:* very large/small numbers and negative inputs.

Ignore non-numeric inputs.

### isPrime
Determines if a number is prime.

*Test cases:* isPrime(5) returns true.

*Extreme cases to handle:* very large/small numbers and non-integer inputs.

Ignore non-numeric inputs.

[Sam Chahine](https://github.com/kingmeers), at [Hero](https://hero.page/)
                

### Tests for abs

![abs](https://img.shields.io/badge/abs()-4%20passed%2C%200%20failed.-13b285)

### Tests for floor

![floor](https://img.shields.io/badge/floor()-3%20passed%2C%200%20failed.-13b285)

### Tests for gcd

![gcd](https://img.shields.io/badge/gcd()-4%20passed%2C%200%20failed.-13b285)

### Tests for ceil

![ceil](https://img.shields.io/badge/ceil()-3%20passed%2C%200%20failed.-13b285)

### Tests for lcm

![lcm](https://img.shields.io/badge/lcm()-3%20passed%2C%201%20failed.-ff69b4)

### Tests for max

![max](https://img.shields.io/badge/max()-4%20passed%2C%200%20failed.-13b285)

### Tests for mean

![mean](https://img.shields.io/badge/mean()-4%20passed%2C%200%20failed.-13b285)

### Tests for median

![median](https://img.shields.io/badge/median()-5%20passed%2C%200%20failed.-13b285)

### Tests for isPrime

![isPrime](https://img.shields.io/badge/isPrime()-5%20passed%2C%200%20failed.-13b285)

### Tests for mode

![mode](https://img.shields.io/badge/mode()-3%20passed%2C%201%20failed.-ff69b4)

### Tests for multiply

![multiply](https://img.shields.io/badge/multiply()-3%20passed%2C%201%20failed.-ff69b4)

### Tests for power

![power](https://img.shields.io/badge/power()-6%20passed%2C%200%20failed.-13b285)

### Tests for round

![round](https://img.shields.io/badge/round()-3%20passed%2C%200%20failed.-13b285)

### Tests for min

![min](https://img.shields.io/badge/min()-4%20passed%2C%200%20failed.-13b285)

### Tests for squareRoot

![squareRoot](https://img.shields.io/badge/squareRoot()-4%20passed%2C%200%20failed.-13b285)

### Tests for subtract

![subtract](https://img.shields.io/badge/subtract()-3%20passed%2C%201%20failed.-ff69b4)

### Tests for trunc

![trunc](https://img.shields.io/badge/trunc()-4%20passed%2C%200%20failed.-13b285)

### Tests for square

![square](https://img.shields.io/badge/square()-3%20passed%2C%200%20failed.-13b285)

### Tests for add

![add](https://img.shields.io/badge/add()-3%20passed%2C%200%20failed.-13b285)

### Tests for divide

![divide](https://img.shields.io/badge/divide()-4%20passed%2C%200%20failed.-13b285)