stella v0.4.0 Number

Documentation for Number.

Link to this section Summary

Functions

Puts a given number to min-max range. In other words, input value will be minimum equal to min value or maximum equal to max value. Function assumes min < max

Check if y is power of x

Determines whether number is equal to the other by given epsilon.

Link to this section Functions

Link to this function

clamp(number, min \\ 0, max \\ 1)

Puts a given number to min-max range. In other words, input value will be minimum equal to min value or maximum equal to max value. Function assumes min < max

Examples

iex> Number.clamp(10, 1, 2)
2

Check if y is power of x

Examples

iex> Number.is_power(10, 1)
false
Link to this function

nearly_equal(x, y, epsilon \\ 1)

Determines whether number is equal to the other by given epsilon.

Examples

iex> Number.nearly_equal(1, 1)
true

iex> Number.nearly_equal(1, 4)
false

iex> Number.nearly_equal(1, 1, 5)
true

iex> Number.nearly_equal(-2, 1, 2)
false