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

Function pow_decimal_float

datafusion/functions/src/math/power.rs:192–207  ·  view source on GitHub ↗

Binary function to calculate a math power to float exponent for scaled integer types.

(base: T, scale: i8, exp: f64)

Source from the content-addressed store, hash-verified

190/// Binary function to calculate a math power to float exponent
191/// for scaled integer types.
192fn pow_decimal_float<T>(base: T, scale: i8, exp: f64) -> Result<T, ArrowError>
193where
194 T: ArrowNativeType + ArrowNativeTypeOp + ToPrimitive + NumCast + Copy,
195{
196 if exp.is_finite() && exp.trunc() == exp && exp >= 0f64 && exp < u32::MAX as f64 {
197 return pow_decimal_int(base, scale, exp as i64);
198 }
199
200 if !exp.is_finite() {
201 return Err(ArrowError::ComputeError(format!(
202 "Cannot use non-finite exp: {exp}"
203 )));
204 }
205
206 pow_decimal_float_fallback(base, scale, exp)
207}
208
209/// Compute the f64 power result and scale it back.
210/// Returns the rounded i128 result for conversion to target type.

Callers 3

pow_decimal_intFunction · 0.85
invoke_with_argsMethod · 0.85

Calls 2

pow_decimal_intFunction · 0.85

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…