Skip to main content

@rbxts/expect > Assertion > closeTo

Assertion.closeTo() method

Asserts that the actual value is a number within epsilon of value.

Signature:

closeTo(value: number): Assertion<number>;

Parameters

Parameter

Type

Description

value

number

The number that the actual value should be within epsilon of.

Returns:

Assertion<number>

Remarks

Type alias for .

Example

const epsilon = 2.220446049250313e-16;
expect(10-epsilon).to.be.closeTo(10);