# math: World of Warcraft Forever API

Forever 1.60.1 (70959), Interface 16001, Lua 5.1, from Blizzard's own API documentation. Page: https://wowaddons.gg/forever-api/math

## Functions

### math.clamp

```lua
clampedValue = math.clamp(value, minimum, maximum)
```

Clamps a value to the inclusive range defined by the minimum and maximum values.

Arguments:
- `value`: number. The value to clamp.
- `minimum`: number. The inclusive lower bound.
- `maximum`: number. The inclusive upper bound.

Returns:
- `clampedValue`: number. The clamped value.

### math.isfinite

```lua
finite = math.isfinite(value)
```

Returns whether a value is finite.

Arguments:
- `value`: number. The value to inspect.

Returns:
- `finite`: bool. True if the value is neither infinite nor NaN; otherwise false.

### math.isinf

```lua
infinite = math.isinf(value)
```

Returns whether a value is positive or negative infinity.

Arguments:
- `value`: number. The value to inspect.

Returns:
- `infinite`: bool. True if the value is positive or negative infinity; otherwise false.

### math.isnan

```lua
nan = math.isnan(value)
```

Returns whether a value is NaN.

Arguments:
- `value`: number. The value to inspect.

Returns:
- `nan`: bool. True if the value is NaN; otherwise false.

### math.lerp

```lua
interpolatedValue = math.lerp(startValue, endValue, amount)
```

Linearly interpolates between two values.

Arguments:
- `startValue`: number. The value returned when the interpolation amount is 0.
- `endValue`: number. The value returned when the interpolation amount is 1.
- `amount`: number. The interpolation amount. Values outside [0, 1] extrapolate beyond the two values.

Returns:
- `interpolatedValue`: number. The interpolated value.

### math.normalize

```lua
normalizedValue = math.normalize(value, minimum, maximum)
```

Returns the relative position of a value within a range, where the minimum maps to 0 and the maximum maps to 1.

Arguments:
- `value`: number. The value to normalize.
- `minimum`: number. The value that maps to 0.
- `maximum`: number. The value that maps to 1.

Returns:
- `normalizedValue`: number. The normalized value. Values outside the input range produce results outside [0, 1].

### math.remap

```lua
remappedValue = math.remap(value, sourceMinimum, sourceMaximum, destinationMinimum, destinationMaximum)
```

Maps a value from one range to the corresponding position in another range.

Arguments:
- `value`: number. The value to map.
- `sourceMinimum`: number. The lower endpoint of the source range.
- `sourceMaximum`: number. The upper endpoint of the source range.
- `destinationMinimum`: number. The lower endpoint of the destination range.
- `destinationMaximum`: number. The upper endpoint of the destination range.

Returns:
- `remappedValue`: number. The mapped value. Values outside the source range are extrapolated beyond the destination range.

### math.round

```lua
roundedValue = math.round(value, [decimalPlaces])
```

Rounds a value to the specified number of decimal places, with halfway values rounded away from zero.

Arguments:
- `value`: number. The value to round.
- `decimalPlaces`: number, default 0. The number of decimal places to preserve. Negative values round to positions left of the decimal point.

Returns:
- `roundedValue`: number. The rounded value.

### math.saturate

```lua
saturatedValue = math.saturate(value)
```

Clamps a value to the inclusive range [0, 1].

Arguments:
- `value`: number. The value to clamp.

Returns:
- `saturatedValue`: number. The value clamped to the inclusive range [0, 1].

### math.sign

```lua
sign = math.sign(value)
```

Returns -1 for negative values, 0 for zero, and 1 for positive values.

Arguments:
- `value`: number. The value whose sign will be returned.

Returns:
- `sign`: number. The sign of the value.

### math.wrap

```lua
wrapped = math.wrap(value, minimum, maximum)
```

Wraps a value into the half-open range [minimum, maximum).

Arguments:
- `value`: number. The value to wrap.
- `minimum`: number. The inclusive lower bound of the range.
- `maximum`: number. The exclusive upper bound of the range.

Returns:
- `wrapped`: number. The wrapped value, greater than or equal to minimum and less than maximum. If minimum equals maximum, returns minimum.

---
Make an addon with your AI: tell it "Read https://wowaddons.gg/agents.md, then make me a World of Warcraft Forever addon that …, try it with me in the game, and publish it."
