trxcllnt commented on code in PR #45251:
URL: https://github.com/apache/arrow/pull/45251#discussion_r1920512210


##########
js/src/util/bn.ts:
##########
@@ -91,15 +91,25 @@ export function bigNumToNumber<T extends 
BN<BigNumArray>>(bn: T, scale?: number)
             number |= word * (BigInt(1) << BigInt(64 * i++));
         }
     }
-    if (typeof scale === 'number') {
-        const denominator = BigInt(Math.pow(10, scale));
+    if (typeof scale === 'number' && scale > 0) {
+        const denominator = BigInt('1' + '0'.repeat(scale));

Review Comment:
   Can use `padEnd()` here:
   ```suggestion
           const denominator = BigInt('1'.padEnd(scale + 1, '0'));
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to