Skip to content

Scalar in arithmetic operations #897

Closed

Description

@CallumECameron

I like the Scalar type introduced in #889 but it doesn't currently play nicely with the existing quantities. All quantities with arithmetic operations should support Scalar in place of double e.g. Scalar * Acceleration or Angle / Scalar.

Activity

  1. angularsen commented on Mar 13, 2021

    @angularsen
    Owner

    It makes sense I suppose.
    I just checked, operator overloads supports implicit cast, so if Scalar implements implicit cast to double then I believe we should be able to reuse all existing operator overloads accepting a double.

    image

    Would you be interested in attempting a pull request? I'm happy to assist.
    A good place to start is adding Scalar.extra.cs in UnitsNet/CustomCode/Quantities/.

  2. CallumECameron commented on Mar 19, 2021

    @CallumECameron
    Author

    Sounds good, that would work. I have raised a PR, there are a couple of issues but can continue discussion there.

  3. stale commented on Jun 2, 2021

    @stale

    This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions