@qctrl/visualizer
Version:
The Q-CTRL Visualizer is a package for displaying animated 3d Bloch sphere visualizations.
13 lines (12 loc) • 761 B
TypeScript
export interface IsCloseTolerance {
rtol?: number;
atol?: number;
}
/**
* Checks whether two numbers are equal within a tolerance.
* The tolerance values are positive, typically very small numbers.
* The relative difference (rtol * abs(b)) and the absolute difference atol are added together to compare against the absolute difference between a and b.
* The equation is not symmetric in a and b – it assumes b is the reference value – so that isclose(a, b) might be different from isclose(b, a).
* A javascript implementation of the python numpy.isClose {@link https://docs.scipy.org/doc/numpy-1.15.1/reference/generated/numpy.isclose.html}
*/
export default function isClose(a: number, b: number, { rtol, atol }?: IsCloseTolerance): boolean;