From 50d14b5c4d1de094e38d115a485f3d773c25e1eb Mon Sep 17 00:00:00 2001 From: Andrew Kubera Date: Sun, 8 Dec 2024 10:27:05 -0500 Subject: [PATCH] Fix types in no-std build --- src/impl_num.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/impl_num.rs b/src/impl_num.rs index 8316efb..9e06f64 100644 --- a/src/impl_num.rs +++ b/src/impl_num.rs @@ -3,6 +3,9 @@ use num_traits::{Zero, Num, Signed, FromPrimitive, ToPrimitive, AsPrimitive}; use num_bigint::{BigInt, Sign, ToBigInt}; +#[cfg(not(feature = "std"))] +use num_traits::float::FloatCore; + use crate::stdlib; use stdlib::str::FromStr; use stdlib::string::{String, ToString}; @@ -14,8 +17,8 @@ use crate::ParseBigDecimalError; #[cfg(not(feature = "std"))] // f64::powi is only available in std, no_std must use libm -fn powi(x: f64, n: f64) -> f64 { - libm::pow(x, n) +fn powi(x: f64, n: i32) -> f64 { + libm::pow(x, n as f64) } #[cfg(feature = "std")]