# 10 examples of 'does int round up or down python' in Python

Every line of 'does int round up or down python' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

## All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
``4def round_down(v):5    return (int(v[0]), int(v[1]))``
``4def roundInt(a): return int(a+0.5)``
``17def round_up(x, base=1):18  return int(base * round(float(x)/base))``
``27def roundint(v):28    return int(round(v))``
``631def rpy_round(number, ndigits):632    # Algorithm copied directly from CPython633634    if number == 0 or rfloat.isinf(number) or rfloat.isnan(number):635        return number636637    # Deal with extreme values for ndigits. For ndigits > NDIGITS_MAX, x638    # always rounds to itself.  For ndigits < NDIGITS_MIN, x always639    # rounds to +-0.0.640    if ndigits > NDIGITS_MAX:641        return number642    elif ndigits < NDIGITS_MIN:643        # return 0.0, but with sign of x644        return 0.0 * number645646    # finite x, and ndigits is not unreasonably large647    z = rfloat.round_double(number, ndigits)648    if rfloat.isinf(z):649        raise OverflowError650    return z``
``71def roundup(n, q):72    import math73    return int(math.ceil(float(n) / float(q)) * q)``
``48def iround(x):49  if (x < 0): return int(x-0.5)50  return int(x+.5)``
``147def round3(x):148	return int(x * 1000) / 1000.0``
``312def p_round(n, precision=5):313    precision = int(precision)314    return int(round(n / float(precision))) * precision``
``40def roundUpToIncrements(inp,inc):41    if inp % inc == 0: return inp42    return inc * (int(inp/inc) + 1)``