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

**URL:** <https://internals.rust-lang.org/t/why-float-consts-are-removed-from-std-num-float/1369>\
**Category:** libs\
**Created:** [January 19, 2015, 6:25pm UTC](https://internals.rust-lang.org/t/why-float-consts-are-removed-from-std-num-float/1369 "2015-01-19T18:25:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hauleth](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/hauleth/32/1322_2.png) [@hauleth](https://internals.rust-lang.org/u/hauleth)\
**Post date:** [January 19, 2015, 6:25pm UTC](https://internals.rust-lang.org/t/why-float-consts-are-removed-from-std-num-float/1369/1 "2015-01-19T18:25:20Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![stebalien](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/stebalien/32/228_2.png) [@stebalien](https://internals.rust-lang.org/u/stebalien)\
**Post date:** [January 19, 2015, 9:42pm UTC](https://internals.rust-lang.org/t/why-float-consts-are-removed-from-std-num-float/1369/2 "2015-01-19T21:42:28Z")

</div>

You may be interested in associated items. Tracking issue: [https://github.com/rust-lang/rust/issues/17307](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](https://github.com/rust-lang/rfcs/blob/master/text/0195-associated-items.md#expressiveness)

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/system/32/14092_2.png) [@system](https://internals.rust-lang.org/u/system)\
**Post date:** [March 25, 2019, 8:23am UTC](https://internals.rust-lang.org/t/why-float-consts-are-removed-from-std-num-float/1369/3 "2019-03-25T08:23:41Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
