-
Notifications
You must be signed in to change notification settings - Fork 396
✨Add arithmetic operators for inversely related quantities #1586
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
base: master
Are you sure you want to change the base?
Conversation
Fixes #1566 Quantities with inverse relations, such as Length and ReciprocalLength, were missing arithmetic operators for things like `Length * ReciprocalLength = double` and `ReciprocalLength / double = Length`. ### Changes - Add missing arithmetic for quantities with inverse relations - Affected: `Density`, `ElectricConductivity`, `ElectricResistivity`, `Length`, `ReciprocalLength`, `Area`, `ReciprocalArea` - Implement `IMultiplyOperators<ReciprocalLength, Length, double>` or similar - Add `public static Length operator /(double value, ReciprocalLength reciprocalLength)` or similar - Add `public static double operator *(ReciprocalLength reciprocalLength, Length length)` or similar - Change `UnitRelations.json` to use `double` instead of `1`, and a new `-- Inverse` configuration flag - Add `IsInverse` and `IsDerived` properties to `QuantityRelation` - Add test `ArithmeticOperators_Relational` for each quantity - Add test `InverseMethod` for each quantity
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1586 +/- ##
========================================
Coverage ? 93%
========================================
Files ? 314
Lines ? 29098
Branches ? 0
========================================
Hits ? 27236
Misses ? 1862
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Are you intentionally going about looking for ways to create more merge conflicts for my 🐲 PR? Why are we still investing in the |
12d3a7e
to
84f06cf
Compare
Sorry, I realize this adds pain for you and probably duplicates some of your work. The big PR has been on the horizon for a very long time and has had way too much stuff in it and I've not spent enough time with it to have a good overview. I'm just trying to close open tickets that have been cropping up for the past months now that I finally found a little time and energy, and I've tried to keep the changes small and targeted.
Well, it's what we currently have in Is the big PR ready for review or are you still massaging it or trying to split off smaller PRs? |
That's my point, the PR has been sitting there forever- and while I'm not saying you should have done a full line-by-line review by now, frankly it feels like you haven't even taken the time to run the samples.
I will continue extracting smaller PRs from it (as long as that's possible), but at some point- you'd have to give me an answer about the overall direction : are we moving towards removing the |
That's fair, I haven't run any of your samples or even attempted reviewing the PR yet as my understanding was that you were still working on it and the chunks you split off were useful on their own so my focus were on those. I'll focus on reviewing the overall idea and design of the PR next then, and the samples you provided, to help determine if the change feels right for the library and for v6. |
FYI, I'm just wrapping up with a PR for the changes to the |
Fixes #1566
Quantities with inverse relations, such as Length and ReciprocalLength, were missing arithmetic operators for things like
Length * ReciprocalLength = double
andReciprocalLength / double = Length
.Changes
Density
,ElectricConductivity
,ElectricResistivity
,Length
,ReciprocalLength
,Area
,ReciprocalArea
IMultiplyOperators<ReciprocalLength, Length, double>
or similarpublic static Length operator /(double value, ReciprocalLength reciprocalLength)
or similarpublic static double operator *(ReciprocalLength reciprocalLength, Length length)
or similarUnitRelations.json
to usedouble
instead of1
, and a new-- Inverse
configuration flagIsInverse
andIsDerived
properties toQuantityRelation
ArithmeticOperators_Relational
for each quantityInverseMethod
for each quantity