Skip to main content
variable approximatelyEqual
import { approximatelyEqual } from "https://deno.land/x/30_seconds_of_typescript@v1.0.1/util.ts";

Checks if two numbers are approximately equal to each other.

Use Math.abs() to compare the absolute difference of the two values to epsilon. Omit the third parameter, epsilon, to use a default value of 0.001.

type

(
v1: number,
v2: number,
epsilon?: number,
) => unknown