-
Notifications
You must be signed in to change notification settings - Fork 393
Allow infinity to be a valid number #998
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
Looking for comments before I touch any code. |
I think the main argument for not supporting NaN and Infinity, is that decimal does not support it. |
I would counter that as completely different underlying types, forcing them into consistent behavior is overly constrictive. Much like some of the arguments for equality, programmers know the underlying type and expect to use them. I would recommend splitting the guard class into a double and decimal version. |
I see your point, but I do think that very few consumers of UnitsNet know anything about the whole double vs decimal dilemma we are currently at. So I do think it would catch some people off guard. In #982 , I would like to revisit the quantities using |
If we can get all quantities onto double, then I would be more onboard with supporting NaN and Infinity. I just think it is not a good experience if some quantities happily accept NaN and others throw an exception, for no intuitive reason. |
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. |
Support for NaN and infinity is of significant interest. Its a major headache in our use of unitsnet. |
I think it might be more natural to support NaN and Infinity after this is merged: #1074 This way, |
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. |
Is your feature request related to a problem? Please describe.
We would like to be able to indicate things such as perfect conductivity or perfectly insulated objects. This requires
double.PositiveInfinity
to be accepted to unit constructors.Describe the solution you'd like
Remove the guard check for infinity.
Describe alternatives you've considered
We have considered using
double.MaxValue
(which is our interim solution), however it is more accurate to use infinity.Note this is a breaking behavior change. Should this be only considered for v5?
The text was updated successfully, but these errors were encountered: