kuerbiskarton commented on issue #38395:
URL: https://github.com/apache/arrow/issues/38395#issuecomment-1781039486

   @zeroshade Thanks for the fix.
   
   I did some testing.
   `decimal256.ToString`, `decimal128.ToString` and `decimal256.FromString` 
work correctly now.
   There is still an off-by-one error in `decimal128.FromString`:
   ```
   func TestFromStringDecimal128b(t *testing.T) {
        const decStr = "766710016439641.74508380782495962772837"
   
        num, err := decimal128.FromString(decStr, 15+23, 23)
        if err != nil {
                t.Error(err)
        } else if decStr != num.ToString(23) {
                t.Errorf("expected: %s, actual: %s\n", decStr, num.ToString(23))
   
                actualCoeff := num.BigInt()
                expectedCoeff, _ := 
(&big.Int{}).SetString(strings.Replace(decStr, ".", "", -1), 10)
                t.Errorf("expected(hex): %X, actual(hex): %X\n", 
expectedCoeff.Bytes(), actualCoeff.Bytes())
        }
   }
   ```
   fails with
   ```
   expected: 766710016439641.74508380782495962772837
   actual  : 766710016439641.74508380782495962772838
   expected(hex): 39AE4C3C2D4C7A4D816B065457BC3565
   actual(hex)  : 39AE4C3C2D4C7A4D816B065457BC3566
   ```


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