Skip to content

Implement to_radians and to_degrees for Float #211

Closed
@frewsxcv

Description

@frewsxcv

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.

Activity

cuviper

cuviper commented on Jul 22, 2016

@cuviper
Member

Curious that those are missing. Is there anything else in f32 and f64 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 and f64 can override with their native versions, of course.

frewsxcv

frewsxcv commented on Jul 22, 2016

@frewsxcv
ContributorAuthor

Relevant discussion in georust/geo#48 by the way. Feel free to take any of my code I wrote.

cuviper

cuviper commented on Jul 23, 2016

@cuviper
Member

Ugh. Rust 1.0 had these stable for f64, but not until 1.7 for f32 . (rust-lang/rust#30672)

frewsxcv

frewsxcv commented on Jul 23, 2016

@frewsxcv
ContributorAuthor

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

cuviper commented on Jul 23, 2016

@cuviper
Member

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.

added a commit that references this issue on Jul 23, 2016
0faeb31
cuviper

cuviper commented on Jul 23, 2016

@cuviper
Member

Please let me know if #212 looks ok to you.

added a commit that references this issue on Jul 24, 2016

Auto merge of #212 - cuviper:float-deg-rad, r=cuviper

f1574d8
added a commit that references this issue on Jun 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Implement to_radians and to_degrees for Float · Issue #211 · rust-num/num