Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
ncave committed Jun 13, 2024
1 parent 7a9db87 commit 67b7ee5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/fable-library-ts/BigInt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,11 @@ export function toFloat32(x: bigint): float32 { return Number(x); }
export function toFloat64(x: bigint): float64 { return Number(x); }

export function toDecimal(x: bigint): decimal {
const low = Number(BigInt.asUintN(32, x))
const mid = Number(BigInt.asUintN(32, x >> 32n))
const high = Number(BigInt.asUintN(32, x >> 64n))
const isNegative = x < zero;
const bits = abs(x);
const low = Number(BigInt.asUintN(32, bits));
const mid = Number(BigInt.asUintN(32, bits >> 32n));
const high = Number(BigInt.asUintN(32, bits >> 64n));
const scale = 0;
return fromParts(low, mid, high, isNegative, scale)
}
Expand Down

0 comments on commit 67b7ee5

Please sign in to comment.