Giter VIP home page Giter VIP logo

Comments (5)

davedelong avatar davedelong commented on May 18, 2024 2

Random thought...

Having Angle<T: Real> be a struct is good, because it makes it easy to add different representations of the underlying angle. You could easily add a public var turns: T, a public var gons: T, etc.

from swift-numerics.

stephentyrone avatar stephentyrone commented on May 18, 2024

I've thought about this design in the past (and did an implementation back in Swift 2 that I never published); it would be as-well-as, rather than instead-of, but it's not actually a bad idea. You start to get into weird typing questions if you aggressively go down this path with the trig functions (by analogy, exp should produce a result type that differs from its argument, with log having the reverse signature, and we need to make the types relate to the angle type when we move to complex operations), but for simpler use cases it can be pretty nice.

from swift-numerics.

jkalias avatar jkalias commented on May 18, 2024

I'm also in favor of the Angle type. In my code base I constantly have to keep in mind if the angle in a given block of code is in radians or degrees (hint: it's always the Angle type).

I'd be more than happy to help here if needed. Forgive me for asking, but what is the consensus: is the issue still relevant (PR/implementation needed) or is there more discussion required?

from swift-numerics.

jkalias avatar jkalias commented on May 18, 2024

from swift-numerics.

mgriebling avatar mgriebling commented on May 18, 2024

Gradians are a metric version of radians. Probably not used much but handheld calculators always had a "DRG" key which supported degrees, radians, and gradians. Noticed, that Apple's calculator does not support it.

from swift-numerics.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.