NumberF.Calculations (NumberF v0.1.6)

View Source

General numeric calculation functions.

Summary

Functions

Calculates combinations (n choose k).

Calculates factorial of a non-negative integer.

Calculates the Greatest Common Divisor (GCD) of two integers.

Checks if a number is within a specified range (inclusive).

Performs a linear interpolation between two points.

Checks if a number is prime.

Calculates the Least Common Multiple (LCM) of two integers.

Calculates a percentage with specified precision.

Rounds a number to the nearest specified value.

Converts radians to degrees.

Converts degrees to radians.

Functions

combinations(n, k)

Calculates combinations (n choose k).

factorial(n)

Calculates factorial of a non-negative integer.

gcd(a, b)

Calculates the Greatest Common Divisor (GCD) of two integers.

in_range?(value, min, max)

Checks if a number is within a specified range (inclusive).

interpolate(x, x0, y0, x1, y1)

Performs a linear interpolation between two points.

is_prime?(n)

Checks if a number is prime.

lcm(a, b)

Calculates the Least Common Multiple (LCM) of two integers.

percentage(value, total, precision)

Calculates a percentage with specified precision.

round_to_nearest(value, nearest)

Rounds a number to the nearest specified value.

to_degrees(radians)

Converts radians to degrees.

to_radians(degrees)

Converts degrees to radians.