-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Fix the DatetIme.Add methods docs to reflect the new behavior in .NET 7.0 #8292
Comments
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
What is the correct statement to make for .NET 7? |
The value parameter is rounded to the nearest tick. |
Likely just enough to say the millisecond rounding exists for < .NET 7 and that's it. |
But this unclear what is .NET 7.0 behavior is. no? |
Sure, but maybe it's "good enough for almost everyone". Whatever works. |
I think saying to |
Note we need to have a comment for other Add APIs like AddMicrosoeconds. I don't think |
Even Consider that In practice it is |
Ok, what do you suggest? leave the docs as it is written |
Noting that there is no "fix" for such large inputs given an API that takes The issue has to do with the finite space in which double can exactly represent integrals and many users not expecting that |
I think something like the following would cover the necessary information:
We could also keep it as is, where it is short/simple or have an expanded remarks section that goes into the problem space in detail. |
Ok, let's keep it as it is for now and we can revisit if we get any complaints. I'll close this issue. |
I'm a puzzled by the decision to leave an incorrect statement in the documentation. Not only does it not round to the nearest millisecond, it doesn't really "round" at all by the typical definition of "round" - it truncates, and not by millisecond. I don't think you need to describe the details of the new conversion. Developers generally understand there are limits to floating point precision. However, I'd love to see something like, "prior to .NET 7, I came across this because these changes broke some of my orbit propagation tests which are very sensitive to time changes. I know the change is minor, but it is a breaking change, and it feels like the documentation should acknowledge that there was a change. |
In .NET 7.0 we have improved the calculation precision for most of Add methods in DateTime. This is done in the PR dotnet/runtime#73198. The docs of these APIs need to get updated to reflect the new behavior.
For example the doc https://docs.microsoft.com/en-us/dotnet/api/system.datetime.addseconds?view=net-6.0#remarks mention
The value parameter is rounded to the nearest millisecond.
which is not true any more.The text was updated successfully, but these errors were encountered: