@rbxts/expect > Assertion > near
Assertion.near() method
Asserts that the actual value is a number within epsilon of value
.
Signature:
near(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
An epsilon is the smallest number representable by a 64 bit double.
Specifically, this method uses the IEEE 754 standard of 2.220446049250313e-16
.
Example
const epsilon = 2.220446049250313e-16;
expect(10-epsilon).to.be.near(10);