@abaplint/runtime 2.8.3 → 2.8.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,7 +17,8 @@ function abs(input) {
17
17
  else {
18
18
  num_in = parseFloat(input.val.get().toString());
19
19
  }
20
- return Math.abs(num_in);
20
+ const ret = Math.abs(num_in);
21
+ return ret;
21
22
  }
22
23
  exports.abs = abs;
23
24
  //# sourceMappingURL=abs.js.map
@@ -7,8 +7,11 @@ function mod(left, right) {
7
7
  if (left instanceof types_1.Integer8 || right instanceof types_1.Integer8) {
8
8
  const l = left instanceof types_1.Integer8 ? left.get() : BigInt((0, _parse_1.parse)(left));
9
9
  const r = right instanceof types_1.Integer8 ? right.get() : BigInt((0, _parse_1.parse)(right));
10
- // todo, is this correct?
11
- return new types_1.Integer8().set(l % r);
10
+ let val = ((l % r) + r) % r;
11
+ if (val < 0) {
12
+ val = val * -1n;
13
+ }
14
+ return new types_1.Integer8().set(val);
12
15
  }
13
16
  const l = (0, _parse_1.parse)(left);
14
17
  const r = (0, _parse_1.parse)(right);
@@ -22,7 +22,11 @@ class Hex {
22
22
  else if (typeof value === "number") {
23
23
  const maxVal = Math.pow(2, this.length * 8);
24
24
  if (value < 0) {
25
- this.value = Math.round(value + maxVal).toString(16);
25
+ let hex = Math.round(value + 0x100000000).toString(16).toUpperCase();
26
+ if (hex.length > this.length * 2) {
27
+ hex = hex.substring(hex.length - this.length * 2);
28
+ }
29
+ this.value = hex;
26
30
  }
27
31
  else if (value >= maxVal) {
28
32
  const sub = value % maxVal;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/runtime",
3
- "version": "2.8.3",
3
+ "version": "2.8.5",
4
4
  "description": "Transpiler - Runtime",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",