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.
48 def iround(x): 49 if (x < 0): return int(x-0.5) 50 return int(x+.5)
74 def ifloor(x): 75 return int(floor(x))
58 def log_floor(n, b): 59 """ 60 The largest integer k such that b^k <= n. 61 """ 62 p = 1 63 k = 0 64 while p <= n: 65 p *= b 66 k += 1 67 return k - 1
77 def floor(x): 78 return Floor(float(x))
30 def ceil(x): 31 return Ceil(float(x))
763 @staticmethod 764 def floor(n: Union[int, float], precision: int = 0) -> Union[int, float]: 765 pass
191 def 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))
36 def _int(val): 37 """ 38 Parse string as an int, even if it has decimals. 39 40 >>> _int('1.0') 41 1 42 >>> _int('1.5') 43 1 44 """ 45 return floor(float(val))
71 def roundup(n, q): 72 import math 73 return int(math.ceil(float(n) / float(q)) * q)
50 def _log2_floor_filter(value): 51 """Returns the logarithm base 2 of the given value, rounded down. 52 53 Args: 54 value: int|float. The specified value. 55 56 Returns: 57 int. The rounded off value of logarithm base 2 of the given value. 58 """ 59 return int(math.log(value, 2))