bmatcuk opened a new pull request #11655: URL: https://github.com/apache/arrow/pull/11655
`bignumToNumber` is giving incorrect results for negative numbers. For example, the following data exists in my dataset: ```javascript // this represents the value -180846 but bignumToNumber() returns -18446744069414765000 const v = new Uint32Array([4294786450, 4294967295, 4294967295, 4294967295]) ``` In this PR, I rewrote the function to handle negative numbers correctly. I've tested it locally. Not sure if there's a more efficient way to write the function. It basically checks the most significant bit to see if it's negative, and, if it is, applies the 2's compliment and multiplies by -1 at the end. I couldn't think of any safe way to avoid multiplying at the end since JS's Number type is not guaranteed to be able to handle the values BigNum can represent, so, there's going to (potentially) be some bits lost in the conversion. So, any bitwise method may result in losing more information than we'd like. -- 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: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org