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 math
73 return int(math.ceil(float(n) / float(q)) * q)
4def round_down(v):
5 return (int(v[0]), int(v[1]))
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 int
251
252 Used for selecting the nearest pixel position.
253
254 WARNING, this method is vectorised to handle a numpy array by NumpyImage
255
256 :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: return
260 n=float(n) # make sure n is a float
261 return int(round(n,0))
238def round2 (n):
239 """ Get nearest power of two superior to n """
240 f = 1
241 while 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) - 1
133 return (val + x) & ~x
576def _round_frac(x, precision):
577 """
578 Round the fractional part of the given number
579 """
580 if not np.isfinite(x) or x == 0:
581 return x
582 else:
583 frac, whole = np.modf(x)
584 if whole == 0:
585 digits = -int(np.floor(np.log10(abs(frac)))) - 1 + precision
586 else:
587 digits = precision
588 return np.around(x, digits)
4def roundInt(a): return int(a+0.5)
27def roundint(v):
28 return int(round(v))

Related snippets