MCPcopy Create free account
hub / github.com/apache/datafusion / round_float

Function round_float

datafusion/functions/src/math/round.rs:633–643  ·  view source on GitHub ↗
(value: T, decimal_places: i32)

Source from the content-addressed store, hash-verified

631}
632
633fn round_float<T>(value: T, decimal_places: i32) -> Result<T, ArrowError>
634where
635 T: num_traits::Float,
636{
637 let factor = T::from(10_f64.powi(decimal_places)).ok_or_else(|| {
638 ArrowError::ComputeError(format!(
639 "Invalid value for decimal places: {decimal_places}"
640 ))
641 })?;
642 Ok((value * factor).round() / factor)
643}
644
645fn round_decimal<V: ArrowNativeTypeOp>(
646 value: V,

Callers 1

invoke_with_argsMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…