Compatibility with `num-traits`
zesterer opened this issue · 4 comments
It would be brilliant for embedded developers constrained to soft floats and a lack of libm
support if this crate provided a wrapper type around f32
that implemented traits from num-traits
. This would allow increased compatibility with the rest of the ecosystem given that num-traits
is the gold standard for numeric values.
Great idea!
@zesterer Can you clarify this suggestion? Are you looking at using num-traits as a dependency, and then impl
ing Float for f32? I'm confused about the need for a wrapper type or what an ideal usage scenario would look like.
@Cazadorro On certain embedded devices, libm
doesn't properly work due to soft float emulation, and therefore Float
and other implementations from num-traits
are not available for f32
. Providing a wrapper type in micromath
like struct F32(f32);
would allow implementing the traits from num-traits
on such platforms.
As part of some other changes I'm doing, I added an F32
newtype in #72.
The larger goal is to move all of the existing arithmetic operation impls to inherent methods on this type.
I intend to work on that first, but in the meantime, if someone else is interested in adding impls of num-traits
to it, that'd be great.