浏览代码

add is_within

master
Jonathan Cobb 3 年前
父节点
当前提交
7ff35206d5
共有 1 个文件被更改,包括 5 次插入0 次删除
  1. +5
    -0
      src/main/resources/org/cobbzilla/util/javascript/standard_js_lib.js

+ 5
- 0
src/main/resources/org/cobbzilla/util/javascript/standard_js_lib.js 查看文件

@@ -174,3 +174,8 @@ function pct_diff (x, y) {
function is_close_enough (x, y, max_pct) {
return 100 - pct_diff(x, y) <= ((typeof max_pct == "undefined") ? 1.0 : max_pct);
}

// return true if x is "within" max_delta of y
function is_within (x, y, max_delta) {
return Math.abs(x - y) < max_delta;
}

正在加载...
取消
保存