找出测量值比较里的 bug

来自 浮点数运算
Node 24 进阶 4分钟 找出 1处问题

找出这段生成测量值检查中的比较缺陷。

JavaScript
function matchesExpected(actual, expected) {
  return Math.abs(actual - expected) <= Number.EPSILON;
}

console.log(matchesExpected(1_000_000_000, 1_000_000_000.0001));
在试验场中打开
报告错误