# 10 examples of 'ceil and floor in python' in Python

Every line of 'ceil and floor in 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
``48def iround(x):49  if (x &lt; 0): return int(x-0.5)50  return int(x+.5)``
``74def ifloor(x):75	return int(floor(x))``
``58def log_floor(n, b):59    """60    The largest integer k such that b^k &lt;= n.61    """62    p = 163    k = 064    while p &lt;= n:65        p *= b66        k += 167    return k - 1``
``77def floor(x):78    return Floor(float(x))``
``30def ceil(x):31    return Ceil(float(x))``
``763@staticmethod764def floor(n: Union[int, float], precision: int = 0) -&gt; Union[int, float]:765    pass``
``191def ceil_n(input_data, n):192    """ Return the ceiling of the input, element-wise closed to devider n."""193    return int(n * np.ceil(input_data / n))``
``36def _int(val):37  """38  Parse string as an int, even if it has decimals.3940  &gt;&gt;&gt; _int('1.0')41  142  &gt;&gt;&gt; _int('1.5')43  144  """45  return floor(float(val))``
``71def roundup(n, q):72    import math73    return int(math.ceil(float(n) / float(q)) * q)``
``50def _log2_floor_filter(value):51    """Returns the logarithm base 2 of the given value, rounded down.5253    Args:54        value: int|float. The specified value.5556    Returns:57        int. The rounded off value of logarithm base 2 of the given value.58    """59    return int(math.log(value, 2))``