Fallback implementation for Decimal256.
(
base: i256,
scale: i8,
exp: f64,
)
| 348 | |
| 349 | /// Fallback implementation for Decimal256. |
| 350 | fn pow_decimal256_float_fallback( |
| 351 | base: i256, |
| 352 | scale: i8, |
| 353 | exp: f64, |
| 354 | ) -> Result<i256, ArrowError> { |
| 355 | if scale < 0 { |
| 356 | return Err(ArrowError::NotYetImplemented(format!( |
| 357 | "Negative scale is not yet supported: {scale}" |
| 358 | ))); |
| 359 | } |
| 360 | |
| 361 | let scale_factor = 10f64.powi(scale as i32); |
| 362 | let base_f64 = base.to_f64().ok_or_else(|| { |
| 363 | ArrowError::ComputeError("Cannot convert base to f64".to_string()) |
| 364 | })? / scale_factor; |
| 365 | |
| 366 | let result_i128 = compute_pow_f64_result(base_f64, scale, exp)?; |
| 367 | |
| 368 | // i256 can be constructed from i128 directly |
| 369 | Ok(i256::from_i128(result_i128)) |
| 370 | } |
| 371 | |
| 372 | /// Fallback implementation for decimal power when exponent is an array. |
| 373 | /// Casts decimal to float64, computes power, and casts back to original decimal type. |
no test coverage detected
searching dependent graphs…