Replacement trait for std::num::Float?


With the beta release std::num::Float has been deprecated. Does this mean that the trait is gone or was it simply moved?

I ask because I’m using it for my quaternion and vector classes, which is generic over f32 and f64 and make extensive use of the Float trait.


The rust devs want to wait a bit before stabilizing number traits (I believe they are waiting for HKT). In the mean-time you can use the num crate on


A lot of the Float functionality moved directly to the primitives f32 and f64 recently. You can’t find them because rustdoc search has an annoying bug making it miss these.

These require specifically annotating the type: 1.0f32.exp() works but 1.0.exp() doesn’t.


Thanks. The num crate is exactly what I’m looking for. What is HKT?


HKT = higher-kinded types


Actually, they are waiting mainly for associated constants.