Closed
Description
https://doc.rust-lang.org/nightly/std/primitive.f64.html#method.to_degrees
https://doc.rust-lang.org/nightly/std/primitive.f64.html#method.to_radians
To better mirror what's offered in the standard library, it'd be nice if these methods were available for any Float
.
Metadata
Metadata
Assignees
Labels
No labels
Activity
cuviper commentedon Jul 22, 2016
Curious that those are missing. Is there anything else in
f32
andf64
that we lack?It's a breaking change to add methods to a trait, unless you provide a default implementation. Is there a way to generically write these? Then
f32
andf64
can override with their native versions, of course.frewsxcv commentedon Jul 22, 2016
Relevant discussion in georust/geo#48 by the way. Feel free to take any of my code I wrote.
cuviper commentedon Jul 23, 2016
Ugh. Rust 1.0 had these stable for
f64
, but not until 1.7 forf32
. (rust-lang/rust#30672)frewsxcv commentedon Jul 23, 2016
What would be the next step forward for this? In what way would it be a breaking change? Do you think it'd be possible to write a default implementation?
cuviper commentedon Jul 23, 2016
It's a little annoying since their
Float
implementations are shared, but I can code it openly for now. And I think I've got a way to write a default too, so it's not a breaking change.traits: add `to_degrees` and `to_radians` on `Float`
to_degrees
andto_radians
onFloat
#212cuviper commentedon Jul 23, 2016
Please let me know if #212 looks ok to you.
Auto merge of #212 - cuviper:float-deg-rad, r=cuviper
Merge pull request rust-num#211 from serde-rs/value