zhengruifeng opened a new pull request, #57820: URL: https://github.com/apache/spark/pull/57820
### What changes were proposed in this pull request? This follow-up updates the native `np.ldexp` mapping to return a zero or infinite significand directly before evaluating `pow(2.0, exp)`. This avoids the invalid intermediate products `0.0 * Infinity` and `Infinity * 0.0`. ### Why are the changes needed? For extreme exponents, the standalone power expression can overflow or underflow before multiplication. The prior native mapping therefore returned `NaN` for valid inputs such as `np.ldexp(0.0, 1024)` and `np.ldexp(np.inf, -1075)`, instead of preserving zero or infinity as NumPy does. ### Does this PR introduce _any_ user-facing change? Yes. It corrects `np.ldexp` results for zero and infinite significands with exponents that overflow or underflow the power intermediate. ### How was this patch tested? Added cases for positive and negative zero with exponent `1024`, plus positive and negative infinity with exponent `-1075`. The test also checks result sign bits. - `python/run-tests --testnames pyspark.pandas.tests.test_numpy_compat.NumPyCompatTests.test_np_ldexp` - `python/run-tests --testnames pyspark.pandas.tests.connect.test_parity_numpy_compat.NumPyCompatParityTests.test_np_ldexp` ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Codex GPT-5 -- 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]
