File "approximatelyEqual.ts"

Full path: /home/fsibplc/public_html/sommilito-bank2/splide-4.1.3/src/js/utils/math/approximatelyEqual/approximatelyEqual.ts
File size: 464 B (464 B bytes)
MIME-type: text/x-java
Charset: utf-8

Download   Open   Edit   Advanced Editor   Back

import { abs } from '../math/math';


/**
 * Checks if the provided 2 numbers are approximately equal or not.
 *
 * @param x       - A number.
 * @param y       - Another number to compare.
 * @param epsilon - An accuracy that defines the approximation.
 *
 * @return `true` if 2 numbers are considered to be equal, or otherwise `false`.
 */
export function approximatelyEqual( x: number, y: number, epsilon: number ): boolean {
  return abs( x - y ) < epsilon;
}