How to use the bs-platform/lib/js/int32.js.abs function in bs-platform

To help you get started, we’ve selected a few bs-platform examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github plow-technologies / bs-Zarith / lib / js / src / Z.js View on Github external
function ediv_rem$prime$1(_a, _b, _cum) {
  while(true) {
    var cum = _cum;
    var b = _b;
    var a = _a;
    var a$1 = Int32.abs(a);
    var b$1 = Int32.abs(b);
    var r = a$1 - b$1 | 0;
    if (Caml_primitive.caml_int32_compare(a$1, b$1) === 1) {
      _cum = cum + Int32.one | 0;
      _b = b$1;
      _a = r;
      continue ;
    } else {
      return /* tuple */[
              cum + Int32.one | 0,
              r
            ];
    }
  };
}
github plow-technologies / bs-Zarith / lib / js / src / Z.js View on Github external
function ediv_rem$prime$1(_a, _b, _cum) {
  while(true) {
    var cum = _cum;
    var b = _b;
    var a = _a;
    var a$1 = Int32.abs(a);
    var b$1 = Int32.abs(b);
    var r = a$1 - b$1 | 0;
    if (Caml_primitive.caml_int32_compare(a$1, b$1) === 1) {
      _cum = cum + Int32.one | 0;
      _b = b$1;
      _a = r;
      continue ;
    } else {
      return /* tuple */[
              cum + Int32.one | 0,
              r
            ];
    }
  };
}
github plow-technologies / bs-Zarith / lib / js / src / Z.js View on Github external
function ediv_rem$1(a, b) {
  if (gt$1(a, Int32.minus_one)) {
    return div_rem$1(a, b);
  } else {
    var match = ediv_rem$prime$1(a, b, Int32.zero);
    return /* tuple */[
            -match[0] | 0,
            Int32.abs(match[1])
          ];
  }
}