You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/04/12 13:59:22 UTC

[GitHub] [arrow] pitrou commented on pull request #9948: ARROW-12150: [Python] Correctly infer type of mixed-precision Decimals

pitrou commented on pull request #9948:
URL: https://github.com/apache/arrow/pull/9948#issuecomment-817835991


   So here is how inference should work IMHO:
   * compute both the magnitude of most-significant digit and least-significant digit
   * examples:
     * `Decimal(12345) => msd = 4, lsd = 0`
     * `Decimal(12345e2) => msd = 6, lsd = 2`
     * `Decimal(1234.5) => msd = 3, lsd = -1`,
     * `Decimal(0.012345) => msd = -2, lsd = -6`
     * `Decimal(0) => msd = -inf, lsd = +inf`
   * track `max(msd)` and `min(lsd)`
   * at the end, `precision = max_msd - min_lsd + 1`, `scale = -min_lsd`
   


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org