--- title: "@std/math" description: "Basic math utilities" jsr: jsr:@std/math pkg: math version: 0.0.0 generated: true stability: stable --- ## Overview

Math functions such as modulo and clamp.

```js import { clamp, modulo } from "@std/math"; import { assertEquals } from "@std/assert"; for (let n = -3; n <= 3; ++n) { const val = n * 12 + 5; // 5 o'clock is always 5 o'clock, no matter how many twelve-hour cycles you add or remove assertEquals(modulo(val, 12), 5); assertEquals(clamp(val, 0, 11), n === 0 ? 5 : n > 0 ? 11 : 0); } ``` ### Add to your project ```sh deno add jsr:@std/math ``` See all symbols in @std/math on