You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "xonx4l (via GitHub)" <gi...@apache.org> on 2025/12/26 02:16:18 UTC

[PR] Add: f16 support to ScalarValue [datafusion]

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

   ## Which issue does this PR close?
   - Closes https://github.com/apache/datafusion/issues/19465.
   
   ## Rationale for this change
   To add Support scalarvalue APIs for f16 regarding Pi values
   
   ## What changes are included in this PR?
   Added half::f16 support to ScalarValue mathematical APIs.
   
   ## Are these changes tested?
   Yes
   
   ## Are there any user-facing changes?
   Yes
   


-- 
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-unsubscribe@datafusion.apache.org

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


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


Re: [PR] Add: PI upper/lower bound f16 constants to ScalarValue [datafusion]

Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey commented on PR #19497:
URL: https://github.com/apache/datafusion/pull/19497#issuecomment-3693943058

   Thanks @xonx4l 


-- 
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-unsubscribe@datafusion.apache.org

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


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


Re: [PR] Add: PI upper/lower bound f16 constants to ScalarValue [datafusion]

Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey commented on code in PR #19497:
URL: https://github.com/apache/datafusion/pull/19497#discussion_r2647421664


##########
datafusion/common/src/scalar/consts.rs:
##########
@@ -17,24 +17,36 @@
 
 // Constants defined for scalar construction.
 
+// Next F16 value above π (upper bound)
+pub(super) const PI_UPPER_F16: half::f16 = half::f16::from_bits(0x4249);

Review Comment:
   How/where are these constants sourced from?



-- 
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-unsubscribe@datafusion.apache.org

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


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


Re: [PR] Add: PI upper/lower bound f16 constants to ScalarValue [datafusion]

Posted by "xonx4l (via GitHub)" <gi...@apache.org>.
xonx4l commented on PR #19497:
URL: https://github.com/apache/datafusion/pull/19497#issuecomment-3692806048

   Thanks for taking the time to write this . Looks great!


-- 
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-unsubscribe@datafusion.apache.org

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


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


Re: [PR] Add: PI upper/lower bound f16 constants to ScalarValue [datafusion]

Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey merged PR #19497:
URL: https://github.com/apache/datafusion/pull/19497


-- 
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-unsubscribe@datafusion.apache.org

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


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


Re: [PR] Add: PI upper/lower bound f16 constants to ScalarValue [datafusion]

Posted by "xonx4l (via GitHub)" <gi...@apache.org>.
xonx4l commented on code in PR #19497:
URL: https://github.com/apache/datafusion/pull/19497#discussion_r2647428598


##########
datafusion/common/src/scalar/consts.rs:
##########
@@ -17,24 +17,36 @@
 
 // Constants defined for scalar construction.
 
+// Next F16 value above π (upper bound)
+pub(super) const PI_UPPER_F16: half::f16 = half::f16::from_bits(0x4249);

Review Comment:
   I converted std::f64::consts::PI to f16 which results in 0x4248 (approx 3.1406). Since this value is slightly lower than the actual Pi. I used the next representable bit pattern (0x4249) to ensure a strict upper bound.



-- 
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-unsubscribe@datafusion.apache.org

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


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


Re: [PR] Add: PI upper/lower bound f16 constants to ScalarValue [datafusion]

Posted by "xonx4l (via GitHub)" <gi...@apache.org>.
xonx4l commented on code in PR #19497:
URL: https://github.com/apache/datafusion/pull/19497#discussion_r2647425601


##########
datafusion/common/src/scalar/consts.rs:
##########
@@ -17,24 +17,36 @@
 
 // Constants defined for scalar construction.
 
+// Next F16 value above π (upper bound)
+pub(super) const PI_UPPER_F16: half::f16 = half::f16::from_bits(0x4249);

Review Comment:
   These are the IEEE 754 binary16 half-precision bit representations closest to pi.



-- 
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-unsubscribe@datafusion.apache.org

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


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