Skip to content

Scalar in arithmetic operations #897

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
CallumECameron opened this issue Jan 20, 2021 · 3 comments
Closed

Scalar in arithmetic operations #897

CallumECameron opened this issue Jan 20, 2021 · 3 comments

Comments

@CallumECameron
Copy link

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.

@angularsen
Copy link
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/.

@CallumECameron
Copy link
Author

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

@stale
Copy link

stale bot commented Jun 2, 2021

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.

@stale stale bot added the wontfix label Jun 2, 2021
@stale stale bot closed this as completed Jun 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants