Why float consts are removed from `std::num::Float`?


#1

As in topic?

I’ve met this problem, when trying to implement generic from_deg function:

impl<T> ExtFloat for T where T: Float {
  fn from_deg(self) -> Self {
    self * Float::pi() / 180.0
  }
}

Now there is no generic way to get Π value. Only way I can think of is cast(f64::consts::PI) which can be problematic with f128 and bigger numeric types.

Have I missed something or that possibility was removed?


#2

You may be interested in associated items. Tracking issue: https://github.com/rust-lang/rust/issues/17307 RFC (relevant section linked): https://github.com/rust-lang/rfcs/blob/master/text/0195-associated-items.md#expressiveness