MCPcopy Create free account
hub / github.com/beutton/browser-flight-simulator / closeTo

Function closeTo

packages/core/src/math.ts:66–77  ·  view source on GitHub ↗
(
  a: number,
  b: number,
  relativeEpsilon: number,
  absoluteEpsilon = relativeEpsilon
)

Source from the content-addressed store, hash-verified

64}
65
66export function closeTo(
67 a: number,
68 b: number,
69 relativeEpsilon: number,
70 absoluteEpsilon = relativeEpsilon
71): boolean {
72 const diff = Math.abs(a - b)
73 return (
74 diff <= absoluteEpsilon ||
75 diff <= relativeEpsilon * Math.max(Math.abs(a), Math.abs(b))
76 )
77}

Callers 1

stars.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected