View Source Lexical.Math (lexical_shared v0.5.0)

Utilities related to mathematical operations

Link to this section Summary

Functions

Clamp the number between min_number and max_number

Link to this section Functions

Link to this function

clamp(number, min_number, max_number)

View Source

Clamp the number between min_number and max_number

If the first argument is less than min_number, then min_number is returned.

If the number given in the first argument is greater than max_number then max_number is returned.

Otherwise, the first argument is returned.