rthummaluru opened a new pull request, #16823:
URL: https://github.com/apache/datafusion/pull/16823

   ## Which issue does this PR close?
   Closes #16712.
   
   ## Rationale for this change
   Rust 1.86 stabilized f64::next_up() and f32::next_up() methods, along with 
their next_down() counterparts. These methods provide IEEE 754 compliant ways 
to get the next representable floating-point value, which is more precise and 
maintainable than manually calculated hardcoded constants.
   The existing hardcoded π-related constants were close approximations, but 
using the standard library methods ensures mathematical correctness and 
improves code clarity.
   
   ## What changes are included in this PR?
   Replaced 8 hardcoded π-related floating-point constants with 
next_up()/next_down() calls
   Removed #[allow(clippy::approx_constant)] attributes (no longer needed)
   Updated comments to explain the purpose (bounds) and method 
(next_up/next_down)
   Removed obsolete TODO comment about next_up/next_down stabilization
   
   Constants updated:
   
   PI_UPPER_F32/F64 → std::f32/f64::consts::PI.next_up()
   NEGATIVE_PI_LOWER_F32/F64 → (-std::f32/f64::consts::PI).next_down()
   FRAC_PI_2_UPPER_F32/F64 → std::f32/f64::consts::FRAC_PI_2.next_up()
   NEGATIVE_FRAC_PI_2_LOWER_F32/F64 → 
(-std::f32/f64::consts::FRAC_PI_2).next_down()
   
   ## Value Analysis:
   All f32 constants remain identical (perfect precision match)
   f64 π constants show minor precision improvements (~4.4e-16)
   f64 π/2 constants remain identical
   
   ## Are these changes tested?
   Yes, these changes are tested by existing tests. The constants are used in 
mathematical functions throughout DataFusion, and all existing tests continue 
to pass, confirming compatibility.


-- 
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: github-unsubscr...@datafusion.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to