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

   Thanks, pushed d598064: for scale <= 19 the product is now exact with one 
64x64->128-bit multiply on the float's 53-bit mantissa (the integer form of 
your FMA idea, which also covers products up to 2^127, so decimal(38, 10) stays 
on it too), the big.Int multipliers are built once, and 
`Decimal32FromFloat`/`Decimal64FromFloat` with float64 input use the same 
helper because they had the same problem (the new 
`TestDecimalFromFloat64MatchesExactRounding` fails on the previous commit for 
Decimal64); float32 inputs keep their float32 rounding, as `FromFloat32` 
already does.
   
   New `BenchmarkDecimalFromFloat64` (1024 values, ns/op, base -> previous 
commit -> now): Decimal128(10,2) 13.3k -> 483k -> 12.9k, Decimal128(38,10) 
13.4k -> 597k -> 12.8k, Decimal256(10,2) 41.2k -> 540k -> 21.6k, all with 0 
allocs now; scale 30 still takes the big path at about 140k (3 allocs per 
value), and Decimal64(18,2) goes from 9.8k to 14.7k for the exact rounding.


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