-
Notifications
You must be signed in to change notification settings - Fork 12
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
Quantities and date arithmetic #509
Conversation
Codecov ReportBase: 85.52% // Head: 86.06% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #509 +/- ##
============================================
+ Coverage 85.52% 86.06% +0.54%
Complexity 25 25
============================================
Files 219 254 +35
Lines 5809 6338 +529
Branches 419 449 +30
============================================
+ Hits 4968 5455 +487
- Misses 622 639 +17
- Partials 219 244 +25
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
I think there is some missing test coverage relating to the use of Integer or Decimal types with a Quantity and a math operator. Currently an expression such as I will add some more tests to cover this, and make the appropriate adjustments to the implementation. |
In cases where one operand is a Quantity and the other is an Integer or Decimal, I think the correct solution to this is to convert the Integer or Decimal to a Quantity with a unit of In the Operators > Math section, the spec says:
The conversion table says that Integer and Decimal types can be implicitly converted to Quantity. |
After a brief trip down that rabbit hole, I worked out that implementing that part of the specification actually provides very little value. I have resolved this problem by adding a new test: I have also added additional validation to |
@piotrszul There seem to be two classes,
|
Or were these two different implementations that you were comparing? Can we retire one of them now? |
Perhaps this can be addressed (the implicit conversions) when (if ever) we implement the explicit conversion functions (e.g.: toQuantity()). Because then it would be just the matter of 'implicitly' applying this function in certain situations. |
Yes, I have a good idea of how it could be done - I'm just not sure that we have a solid use case for it at the moment. |
Yes, we can retire the string based implementation (FlexDecimal). As for the benchmark I would prefer to retain it (for decimal and FlexiDecimal) but just do not include it in the build. It may still be useful to run it locally to possibly further optimize FlexiDeciamal performance. The easies way to achieve it is to rename the class so that it does not fit the patters from |
Ok, I have kept the DecimalBenchmark in but disabled, and with FlexDecimal removed. |
Resolves #340 and #341.