srielau opened a new pull request, #59480:
URL: https://github.com/apache/spark/pull/59480

   ### What changes were proposed in this pull request?
   
   This PR is stacked on #58410. The incremental commit adds a generic IEEE 754 
BID-k path on top of the specialized `Bid64` / `Bid128` kernels.
   
   - `FormatParams` describes packed widths `k = 32, 64, ..., 256` (`p`, `w`, 
`t`, `emax`, `bias`).
   - `BidCodec` pack/unpacks the combination field into little-endian `long[]` 
words.
   - `BidK` / `BidKRaw` implement add, sub, mul, div, sqrt, FMA, quantize, and 
convert using `DecNum` and `UIntLimbs` (up to 4 longs).
   - Decimal96 is the proving format, including convert to BID64/128.
   - Decimal160 through Decimal256 use the same arithmetic path.
   - Transcendentals for `k <= 128` convert through `Bid128` and the binary128 
DPML engine. `k > 128` libm throws until a binary256 engine is funded.
   
   `Bid64` and `Bid128` remain the hot-path kernels. No Spark SQL consumer is 
added.
   
   ### Why are the changes needed?
   
   IEEE 754 decimal interchange is parameterized by packed width `k`, not only 
64 and 128. Spark's decimal precision goes to 38, which is above 
decimal64/128's 16/34 digits. Decimal96 (25 digits) and the wider formats let 
LibBID cover that range without inventing a non-IEEE encoding.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No. LibBID remains an unpublished internal module with no Spark execution 
path.
   
   ### How was this patch tested?
   
   - `BidKTest`: IEEE format table, codec round-trips vs `Bid64`/`Bid128`, 
Decimal96 convert, add/mul/div/sqrt property tests vs `BigDecimal` for k=96 and 
160-256, five rounding modes, SQL adapters, DPML `exp` on Decimal96, and 
unsupported libm for k=160.
   - `libbid/testOnly org.bidfp.LibraryTests` (29 tests, including Intel 
vectors and `bidK`).
   - `./dev/lint-java` (checkstyle passed).
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Cursor Grok 4.6


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to