| math.inf | ∞, ≡ float(“inf”) | 
| math.prod(iterable, *, start=1) | def prod(iterable, *, start=1):for element in iterable:
 start *= element
 return start
 | 
| math.floor(f) -> int | ⌊ f ⌋ | 
| math.ceil(f) -> int | ⌈ f ⌉ | 
| math.sqrt(x) -> float | ≡ x ** (1/2), if x >= 0 
math.sqrt(x)is significantly faster thanx ** 0.5.About processing negative numbers:
That means sqrt()only works on positive values. But the **operator is able to return a complex number,note the weird rounding error where the real part should be zero
 (ex:
 (-4) ** 0.5 ⇒ (1.2246467991473532e-16+2j)). cmath.sqrt()returns the perfect complex value probably(ex:
 cmath.sqrt(-4) ⇒ 2j),because as opposed to
 **,sqrt()is a specialized square root computation,
 not just a float
 powmethod.
 | 
| math.isqrt(x: int) -> int | ≡ floor(x ** (1/2)) | 
| math.pow(x, y[, z]) | ≡ (x ** (y)) [% z] math.pow(x, y, z)is quite faster than(x ** y) % z其時間複雜度為 O(log(y))
 | 
Last Updated on 2025/08/13 by A1go