trunc(ate), div(ide): document behavior and implement "fixed" versions.#7387
Draft
HotwheelsSisyphus wants to merge 1 commit into
Draft
trunc(ate), div(ide): document behavior and implement "fixed" versions.#7387HotwheelsSisyphus wants to merge 1 commit into
HotwheelsSisyphus wants to merge 1 commit into
Conversation
also adds methods (not implemented yet, to be added in a later commit): truncate divide roundDown (optional alias for the old trunc)
Member
|
Thank you for this overview! For the dev meeting in may, we'll write up a strategy (with @capital-G and you could also join!). |
Member
|
As a direct reply for the part 2: There is a slightly difficult trade-off to be made with respect to unary vs. binary op.
I tend towards the first one, and (still, sorry!) towards naming it
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thought it would be better to reopen this on another branch. Basically waiting for instructions now.
The story so far
As discussed in that other issue (#2378).
divactually has a similar problem, but we did not discuss it explicitly.(i.e.,
a.div(b) == floor(a/b)but is normally equivalent tostd::trunc(a/b)).We had a little "vote" in #2378 (comment), and there are now 2 votes for
truncateand 0 fortrunc2as a name for the "standard" method, though I recall that this was tied 2-2 as some point.(That quorum is, uh, suboptimal, but what can ya do.)
I think I've now figured out how to do this but I do need some direction/decision by more experienced folks as to what exactly to do.
We've agreed on non-breaking changes, i.e., only adding things rather than changing interfaces (i.e., not simply "fixing" the existing trunc). So at any rate, the resulting solution should not break code written in sclang. So that doesn't need to be discussed. The question is really about the Server side only.
There are two main options:
1 of course is simplest. It just seems a bit inelegant and adds more code. Sort of a shantytown approach.
2 replaces some code in the server and adds very little to the class library.
For 2, there would be 2 options:
Within 1, two more questions:
truncate, the question is:trunc, then it would a binary op, with two extra multiplications. (Sc'struncis currentlystd::floor(a/b) * b; a binary optruncatewould bestd::trunc(a/b) *b. )trunc, then it would be unary.I think that's roughly it.