vera-rubin commented on PR #1663:
URL: https://github.com/apache/arrow-go/pull/1663#issuecomment-7244004586

   Pushed c819c65:
   
   - Negative precision: d598064 indexed the multiplier table with it and 
panicked (for example `Decimal256FromFloat(1.5, -1, 2)`), where main returns an 
error. Negative precisions now take the old float path again, so they behave as 
on main; `TestDecimalFromFloat64NegativePrecision` covers it.
   - Scales 20 to 22 no longer use `big.Int`. For scale <= 22 the product is 
now first taken in float64, as you suggested: below 2^52 and not on a 
half-integer, rounding it is exact, and on a half-integer the sign of 
`math.FMA(v, 10^scale, -p)` decides. Larger products use the exact product of 
the 53-bit mantissa and the 128-bit 10^scale. 
`TestDecimalFromFloat64MatchesExactRounding` now also covers Decimal32 and 
values whose float64 product lands on a tie.
   
   `BenchmarkDecimalFromFloat64` (1024 values, ns/op, median of 8 runs, main -> 
d598064 -> now; the box had other load, so these are noisy): Decimal128(38,22) 
27.1k -> 305k -> 18.2k, Decimal128(10,2) 17.6k -> 19.3k -> 11.3k, 
Decimal256(10,2) 54.9k -> 26.6k -> 21.8k, all with 0 allocs now. 
Decimal64(18,2) and Decimal32(9,2) are still slightly slower than main: 7.5k -> 
8.5k and 7.4k -> 8.4k (12 runs pinned to one core), down from about 13.5k on 
d598064. Scales above 22 keep the `big.Int` path with 3 allocs per value and 
stay several times slower than main: Decimal128(38,30) 19.7k -> 260k, 
Decimal256(76,30) 56.4k -> 201k.
   
   The release-note line is in the user-facing section of the description.


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