-
-
Notifications
You must be signed in to change notification settings - Fork 744
fix issue 9717 - std.math.round
rounds away from zero instead of to the nearest even integer
#3849
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
Conversation
… the nearest even integer
|
Looks good to me. |
👍 |
Auto-merge toggled on |
fix issue 9717 - `std.math.round` rounds away from zero instead of to the nearest even integer
What is the point of documenting useless implementation detail? |
Also am I correct that people who don't care about rounding just created the pull, discussed it and merged? If you don't use some sort of mathematics stuff it doesn't mead you can remove it from language and document its bugs. I strongly advise to review my comments and fix situation or create an appropriate explanation and post it here and in issue 9717. |
Obviously it's not a "useless" detail judging by how upset you are about it. It's important that the documentation describe what the function actually does, even if only so that people who want something different know to not to use it.
No.
EDIT: After checking git blame, I see that this is probably a bug, after all. See the next post. |
@denis-sh @ibuclaw The original implementation just called So, the bug is with the implementation, not the docs. Unfortunately, I see no good solution to this given that the mismatch has been in place for eight years now. The best thing would probably be to deprecate this function and tell people to use Just fixing the implementation after all this time could easily break just as much code as it fixed. |
Yes, as we probably shouldn't just change functionality of existing functions it will be good to deprecate them to not pollute our library with useless C function analogs. |
In the meantime, this PR should stay merged since we're not changing the implementation. A follow-up PR to deprecate I don't see a need to deprecate |
This function is as useless as |
The intrinsics in std.math are no different to this either, to be honest. :-) |
The cost of maintaining a one-liner function like that is trivial, and there are no doubt people who are using it in their projects. I do agree that Some of the changes I'd like to see (in no particular order):
I think fixing as much as possible of this stuff at once would be easier and less disruptive in the long run - especially since the old module could be kept for backwards compatibility as long as necessary. |
Agree. Is there an enhancement request for this? It not, please file one in bugzilla to consolidate links and thoughts. |
This is probably into DIP territory, although my thought was to start by just writing something and sticking it on dub as a discussion starter. Either way, my main focus right now is getting a checked integer module into Phobos. I might work on |
No description provided.