@std/math

Overview

Scalar math helpers and the Vec2 value type. Angles are radians, so turn degrees into radians with value * Math.PI() / 180.0.

.rnx
import { Math, Vec2 } from "@std/math";

let v = new Vec2(3.0, 4.0);
print(v.length());
print(Math.sin(Math.PI() / 2.0));

When to use it

Reach for @std/math for scalar numerics (sqrt, trig, floor/ceil) and the Vec2 value type for 2D geometry. For 4-lane vector throughput, step up to @std/simd.

Capabilities

  • IEEE-754 intrinsics
  • Vec2 geometry
  • Float helpers

Symbols

  • class Math — Static numeric helpers: constants, comparisons, rounding, and the
  • class Vec2 — 2D float vector with dot products and lengths. The fields are public and