-
Notifications
You must be signed in to change notification settings - Fork 391
Is there a reason, the conversion properties return double for quantities with base type decimal? #1058
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
Comments
I agree it's not great. We just closed #1051 which would have deprecated the double conversion properties in favor of returning a Feel free to look over the arguments there, but I do feel that returning a |
There is also #875 for you (all) to consider- it's not the most straightforward approach and I haven't thought it through a 100% - but that's why I put it up for discussion. |
Although not as convenient, you can also use BitRate rate = BitRate.FromKilobitsPerSecond(56);
decimal mb = rate.ToUnit(BitRateUnit.MegabitPerSecond).Value; |
Closing this in favor of #875 |
Re-opening, realized this describes one of several solutions discussed in #875 .
|
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. |
Not stale, PR #1074 recently had activity. |
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. |
Not stale, PR still up for review. |
Fixes #1058 Return the correct value type for quantities that use `decimal` internally; `Power, Information, BitRate`. - Quantity properties return `decimal` or `double` based on internal value type. - `IQuantity.Value` returns `QuantityValue`, which supports both double and decimal. - `QuantityValue`: Implement IEquality<QuantityValue>, IComparable<QuantityValue>, IComparable. Co-authored-by: Andreas Gullberg Larsen <andreas.larsen84@gmail.com>
Fixed by #1074 |
Some quantities, for instance
information
havedecimal
as base type (which does make sense). However, except for theValue
property, all properties return double:This is a bit confusing and unnecessarily looses precision. Would it be possible to change these properties to
decimal
, too?The text was updated successfully, but these errors were encountered: