scovich commented on code in PR #9689:
URL: https://github.com/apache/arrow-rs/pull/9689#discussion_r3065665727


##########
arrow-cast/src/cast/decimal.rs:
##########
@@ -802,6 +802,17 @@ where
     }
 }
 
+/// Cast a single floating point value to a decimal native with the given 
multiple.
+/// Returns `None` if the value cannot be represented with the requested 
precision.
+#[inline]
+pub fn single_float_to_decimal<D>(input: f64, mul: f64) -> Option<D::Native>
+where
+    D: DecimalType + ArrowPrimitiveType,
+    <D as ArrowPrimitiveType>::Native: DecimalCast,
+{
+    D::Native::from_f64((mul * input).round())

Review Comment:
   NVM... I confused this with the int-decimal cast code. Floating point 
multiplies never panic in Rust



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

Reply via email to