-
Notifications
You must be signed in to change notification settings - Fork 3
[JS] Easier way to work with decimals #100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
Type: enhancement
New feature or request
Comments
domoritz
referenced
this issue
in apache/arrow
Apr 22, 2023
### What changes are included in this PR? Closes #22932 Basically, signed negative numbers were displayed as very large positive numbers. ### Are these changes tested? Yes, I've also added tests for `bn.ts` (BigNum) that was not tested before. ### Are there any user-facing changes? Negative numbers stored in BigNum will now be displayed as negative numbers instead of very large positive numbers. Note that this change also affects decimals, because they are stored in BigNum as signed numbers. Decimals still don't convert to string correctly, because inserting the decimal dot is not implemented. Ref #28804. * Closes: #35067 Lead-authored-by: Aljaž Mur Eržen <[email protected]> Co-authored-by: Aljaž Mur Eržen <[email protected]> Co-authored-by: Paul Taylor <[email protected]> Signed-off-by: Dominik Moritz <[email protected]>
liujiacheng777
referenced
this issue
in LoongArch-Python/arrow
May 11, 2023
) ### What changes are included in this PR? Closes apache#22932 Basically, signed negative numbers were displayed as very large positive numbers. ### Are these changes tested? Yes, I've also added tests for `bn.ts` (BigNum) that was not tested before. ### Are there any user-facing changes? Negative numbers stored in BigNum will now be displayed as negative numbers instead of very large positive numbers. Note that this change also affects decimals, because they are stored in BigNum as signed numbers. Decimals still don't convert to string correctly, because inserting the decimal dot is not implemented. Ref #28804. * Closes: apache#35067 Lead-authored-by: Aljaž Mur Eržen <[email protected]> Co-authored-by: Aljaž Mur Eržen <[email protected]> Co-authored-by: Paul Taylor <[email protected]> Signed-off-by: Dominik Moritz <[email protected]>
ArgusLi
referenced
this issue
in Bit-Quill/arrow
May 15, 2023
) ### What changes are included in this PR? Closes apache#22932 Basically, signed negative numbers were displayed as very large positive numbers. ### Are these changes tested? Yes, I've also added tests for `bn.ts` (BigNum) that was not tested before. ### Are there any user-facing changes? Negative numbers stored in BigNum will now be displayed as negative numbers instead of very large positive numbers. Note that this change also affects decimals, because they are stored in BigNum as signed numbers. Decimals still don't convert to string correctly, because inserting the decimal dot is not implemented. Ref #28804. * Closes: apache#35067 Lead-authored-by: Aljaž Mur Eržen <[email protected]> Co-authored-by: Aljaž Mur Eržen <[email protected]> Co-authored-by: Paul Taylor <[email protected]> Signed-off-by: Dominik Moritz <[email protected]>
rtpsw
referenced
this issue
in rtpsw/arrow
May 16, 2023
) ### What changes are included in this PR? Closes apache#22932 Basically, signed negative numbers were displayed as very large positive numbers. ### Are these changes tested? Yes, I've also added tests for `bn.ts` (BigNum) that was not tested before. ### Are there any user-facing changes? Negative numbers stored in BigNum will now be displayed as negative numbers instead of very large positive numbers. Note that this change also affects decimals, because they are stored in BigNum as signed numbers. Decimals still don't convert to string correctly, because inserting the decimal dot is not implemented. Ref #28804. * Closes: apache#35067 Lead-authored-by: Aljaž Mur Eržen <[email protected]> Co-authored-by: Aljaž Mur Eržen <[email protected]> Co-authored-by: Paul Taylor <[email protected]> Signed-off-by: Dominik Moritz <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have table with a column, let’s call the column c. c.type returns Decimal {scale: 3, precision: 12}. c.get(0) returns [519500, 0, 0, 0]. I know the value should be 519.5. After much digging, I found that the value is actually an arrow “big number” (https://github.com/apache/arrow/blob/ccdbbe3b765d4df9b2b91270a69ad78a086f2d77/js/src/util/bn.ts), so it has a valueOf function which returns 519500 (with the obvious caveat that it’ll overflow if the number is more than 53-bits). I could divide that by 10^scale from c.type to get 519.5. Is there some easier way to do that?
Filed by [email protected]
Reporter: Dominik Moritz / @domoritz
Note: This issue was originally created as ARROW-13099. Please see the migration documentation for further details.
The text was updated successfully, but these errors were encountered: