www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18086] New: BigInt DivMod


          Issue ID: 18086
           Summary: BigInt DivMod
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: jack jackstouffer.com

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.

Dec 15 2017