# 10 examples of 'python roundup to nearest 10' in Python

Every line of 'python roundup to nearest 10' 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
``71def roundup(n, q):72    import math73    return int(math.ceil(float(n) / float(q)) * q)``
``4def round_down(v):5    return (int(v), int(v))``
``17def round_up(x, base=1):18  return int(base * round(float(x)/base))``
``248def nearest(n):249    """250    round up or down to nearest int returning an int251252    Used for selecting the nearest pixel position.253254    WARNING, this method is vectorised to handle a numpy array by NumpyImage255256    :param a number or array of numbers: virtual pixel position (x or y)257    :return int: nearest integer (round up/down)258    """259    if type(n) is None: return260    n=float(n) # make sure n is a float261    return int(round(n,0))``
``238def round2 (n):239    """ Get nearest power of two superior to n """240    f = 1241    while f<n:242        f*= 2243    return f``
``312def p_round(n, precision=5):313    precision = int(precision)314    return int(round(n / float(precision))) * precision``
``130def roundup(val, width):131  """roundup a value to N x width-bits"""132  x = (width >> 3) - 1133  return (val + x) & ~x``
``576def _round_frac(x, precision):577    """578    Round the fractional part of the given number579    """580    if not np.isfinite(x) or x == 0:581        return x582    else:583        frac, whole = np.modf(x)584        if whole == 0:585            digits = -int(np.floor(np.log10(abs(frac)))) - 1 + precision586        else:587            digits = precision588        return np.around(x, digits)``
``4def roundInt(a): return int(a+0.5)``
``27def roundint(v):28    return int(round(v))``