Hello,
I'm using num-rational in a no_std project (target is custom, based on x86_64-unknown-none) and am getting a linker error when using Rational32::approximate_float. It seems to be coming from a cast in this crate in an impl of ToPrimitive (I'm guessing specifically <f64 as ToPrimitive>::to_f32). I've tried explicitly enabling the libm feature for num-traits in my Cargo.toml, but that didn't help because it seems like the ToPrimitive definitions don't have libm versions.
num-rational = { version = "0.2.4", default-features = false }
= note: rust-lld: error: undefined symbol: __truncdfsf2
>>> referenced by cast.rs:282 ($HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/num-traits-0.2.11/src/cast.rs:282)
>>> snos_timer-8311147c5ab4bb97.515o52wkw29kkh3p.rcgu.o:(_$LT$f64$u20$as$u20$num_traits..cast..ToPrimitive$GT$::to_f32::hb2bd91b56346d11b) in archive $PROJECT/target/x86_64-snos/debug/deps/libsnos_timer-8311147c5ab4bb97.rlib
Is the solution to this just to provide a libm version of the ToPrimitive impls? Does one already exist that I'm missing and I'm just not enabling the libm feature correctly? Any advice is appreciated.
Hello,
I'm using
num-rationalin ano_stdproject (target is custom, based onx86_64-unknown-none) and am getting a linker error when usingRational32::approximate_float. It seems to be coming from a cast in this crate in an impl ofToPrimitive(I'm guessing specifically<f64 as ToPrimitive>::to_f32). I've tried explicitly enabling thelibmfeature fornum-traitsin myCargo.toml, but that didn't help because it seems like theToPrimitivedefinitions don't havelibmversions.Is the solution to this just to provide a
libmversion of theToPrimitiveimpls? Does one already exist that I'm missing and I'm just not enabling thelibmfeature correctly? Any advice is appreciated.