You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "zhengruifeng (via GitHub)" <gi...@apache.org> on 2026/08/06 09:06:30 UTC

[PR] [SPARK-58580][PS][FOLLOWUP] Preserve ldexp zero and infinity inputs [spark]

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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-58580][PS][FOLLOWUP] Preserve ldexp zero and infinity inputs [spark]

Posted by "zhengruifeng (via GitHub)" <gi...@apache.org>.
zhengruifeng closed pull request #57820: [SPARK-58580][PS][FOLLOWUP] Preserve ldexp zero and infinity inputs
URL: https://github.com/apache/spark/pull/57820


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-58580][PS][FOLLOWUP] Preserve ldexp zero and infinity inputs [spark]

Posted by "zhengruifeng (via GitHub)" <gi...@apache.org>.
zhengruifeng commented on PR #57820:
URL: https://github.com/apache/spark/pull/57820#issuecomment-5204038704

   **Merge Summary:**
   - merged into master https://github.com/apache/spark/commit/3afa7999adbb6ea9f50d689ccb01ba8cfb353e3e
   - merged into branch-4.x https://github.com/apache/spark/commit/aa1ad65503c531e3b9567a8c58ea29c595076596
   
   *Posted by `merge_spark_pr.py`*


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org