Binary function to calculate a math power to float exponent for scaled integer types.
(base: T, scale: i8, exp: f64)
| 190 | /// Binary function to calculate a math power to float exponent |
| 191 | /// for scaled integer types. |
| 192 | fn pow_decimal_float<T>(base: T, scale: i8, exp: f64) -> Result<T, ArrowError> |
| 193 | where |
| 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. |
searching dependent graphs…