How can I split two NSIntegers, like 13/4, and round the result to the next integer = 3?
I saw several examples converting integers to float and back to integer. But what is the recommended way with the least code for this?
Assuming x >= 0 and y > 0 :
x >= 0
y > 0
If you want to round: x / y
x / y
If you want to round: (x + y - 1) / y
(x + y - 1) / y
If you want to round to the nearest: (x + y / 2) / y
(x + y / 2) / y
Source: https://habr.com/ru/post/1442846/More articles:Python: returns values ββfrom a loop without a break - pythonCan AutoMapper indirectly smooth this mapping? - automapperPython line breaks - pythonUsing DataMatrix code as keyboard input - c #WebMatrix Database. Open ... Close () and Dispose () - disposeSerialize XmlDoc comments with data - c #Deep Stencil Doesn't Work - DirectX 10 C ++ - c ++Finding neighbors in a list - pythonIncluding all request parameters in Html.ActionLink - c #How to work with global variables when calling fortran code in python (e.g. with f2py)? - pythonAll Articles