@tempots/color

nearEquals() function

number numbers can sometime introduce tiny errors even for simple operations. nearEquals compares two floats using a tiny tollerance (last optional argument). By default it is defined as EPSILON.

Signature:

nearEquals: (a: number, b: number, tollerance?: number) => boolean

Parameters

Parameter

Type

Description

a

number

The first number to compare.

b

number

The second number to compare.

tollerance

number

(Optional) The tollerance value for comparing the two numbers.

Returns: boolean

true if the two numbers are very close, false otherwise.