@fable-org/fable-library-ts 1.4.1 → 1.4.2

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.
package/BigInt.ts CHANGED
@@ -148,10 +148,11 @@ export function toFloat32(x: bigint): float32 { return Number(x); }
148
148
  export function toFloat64(x: bigint): float64 { return Number(x); }
149
149
 
150
150
  export function toDecimal(x: bigint): decimal {
151
- const low = Number(BigInt.asUintN(32, x))
152
- const mid = Number(BigInt.asUintN(32, x >> 32n))
153
- const high = Number(BigInt.asUintN(32, x >> 64n))
154
151
  const isNegative = x < zero;
152
+ const bits = abs(x);
153
+ const low = Number(BigInt.asUintN(32, bits));
154
+ const mid = Number(BigInt.asUintN(32, bits >> 32n));
155
+ const high = Number(BigInt.asUintN(32, bits >> 64n));
155
156
  const scale = 0;
156
157
  return fromParts(low, mid, high, isNegative, scale)
157
158
  }
package/CHANGELOG.md CHANGED
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## Unreleased
9
9
 
10
+ ## 1.4.2 - 2024-06-13
11
+
12
+ ### Fixed
13
+
14
+ * [JS/TS] Fixed BigInt.ToDecimal with negative values (#3500) (by @ncave)
15
+
10
16
  ## 1.4.1 - 2024-06-13
11
17
 
12
18
  ### Fixed
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "private": false,
4
4
  "type": "module",
5
5
  "name": "@fable-org/fable-library-ts",
6
- "version": "1.4.1",
6
+ "version": "1.4.2",
7
7
  "description": "Core library used by F# projects compiled with fable.io",
8
8
  "author": "Fable Contributors",
9
9
  "license": "MIT",