Bug 18086 – BigInt DivMod

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-12-15T22:04:42Z
Last change time
2018-02-10T22:10:23Z
Assigned to
No Owner
Creator
Jack Stouffer

Comments

Comment #0 by jack — 2017-12-15T22:04:42Z
Internally, BigInt finds division and modulo with the divModInternal function. This functionality should be exposed to the user as a divMod function (naming from Python) so both operations can be done at once. An example of where this would be useful is when rounding a BigInt to a certain number of digits, you have to divide by ten, but also keep track of what the last digit was in order to know if you should increase the final result by one.
Comment #1 by github-bugzilla — 2018-01-30T15:52:56Z
Commit pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/203499a93f741697889072a158ab9863548d0c41 Merge pull request #5937 from Biotronic/Issue18086 Fix Issue 18086 - BigInt DivMod
Comment #2 by paul.d.anderson — 2018-02-09T22:25:09Z
I get an access error when calling this function using v2.078.1-master-419f135. Looking at the code, it seems like the function was never made public, hence the error. Is this an oversight or am I mistaken? Paul
Comment #3 by greensunny12 — 2018-02-10T00:20:46Z
Works fine for me: https://run.dlang.io/is/r07zHf (setting this to RESOLVED FIXED as the PR has been merged) Are you sure you are using nightly?
Comment #4 by paul.d.anderson — 2018-02-10T22:10:23Z
(In reply to Seb from comment #3) > Works fine for me: > > https://run.dlang.io/is/r07zHf > > (setting this to RESOLVED FIXED as the PR has been merged) > > Are you sure you are using nightly? Sorry, my mistake.