100 lines
2 KiB
Plaintext
100 lines
2 KiB
Plaintext
import PABCSystem
|
|
|
|
pi = 3.14159265358979
|
|
|
|
def sqrt(x: float) -> float:
|
|
return PABCSystem.sqrt(x)
|
|
|
|
def trunc(x: float) -> int:
|
|
return PABCSystem.trunc(x)
|
|
|
|
def floor(x: float) -> int:
|
|
return PABCSystem.floor(x)
|
|
|
|
def ceil(x: float) -> int:
|
|
return PABCSystem.ceil(x)
|
|
|
|
def log(x: float) -> float:
|
|
return PABCSystem.Log(x)
|
|
|
|
def log1p(x: float) -> float:
|
|
return PABCSystem.Log(1+ x)
|
|
|
|
def log2(x: float) -> float:
|
|
return PABCSystem.Log2(x)
|
|
|
|
def log10(x: float) -> float:
|
|
return PABCSystem.Log10(x)
|
|
|
|
def log(x: float, base: int) -> float:
|
|
return PABCSystem.LogN(base, x)
|
|
|
|
def exp(x: float) -> float:
|
|
return PABCSystem.exp(x)
|
|
|
|
def expm1(x: float) -> float:
|
|
return PABCSystem.exp(x - 1)
|
|
|
|
def exp2(x: float) -> float:
|
|
return PABCSystem.exp(log(2) * x)
|
|
|
|
def sin(x: float) -> float:
|
|
return PABCSystem.sin(x)
|
|
|
|
def sinh(x: float) -> float:
|
|
return PABCSystem.sinh(x)
|
|
|
|
def cos(x: float) -> float:
|
|
return PABCSystem.cos(x)
|
|
|
|
def cosh(x: float) -> float:
|
|
return PABCSystem.cosh(x)
|
|
|
|
def tan(x: float) -> float:
|
|
return PABCSystem.tan(x)
|
|
|
|
def tanh(x: float) -> float:
|
|
return PABCSystem.tanh(x)
|
|
|
|
def acos(x: float) -> float:
|
|
return PABCSystem.arccos(x)
|
|
|
|
def asin(x: float) -> float:
|
|
return PABCSystem.arcsin(x)
|
|
|
|
def atan(x: float) -> float:
|
|
return PABCSystem.arctan(x)
|
|
|
|
def atan2(y: float, x: float) -> float:
|
|
return PABCSystem.arctan(y / x)
|
|
|
|
def pow(x: float, y: int) -> float:
|
|
return PABCSystem.power(x, y)
|
|
|
|
def cbrt(x: float) -> float:
|
|
return pow(x, 1/3)
|
|
|
|
def fabs(x: float) -> float:
|
|
return PABCSystem.abs(x)
|
|
|
|
def pow(x: float, y: float) -> float:
|
|
return PABCSystem.power(x, y)
|
|
|
|
def isqrt(x: int) -> int:
|
|
return floor(sqrt(x))
|
|
|
|
def remainder(x: int, y: int) -> int:
|
|
return x - (x // y) * y
|
|
|
|
def factorial(n: int) -> int:
|
|
if n == 0:
|
|
return 1
|
|
return n * factorial(n - 1)
|
|
|
|
def perm(n: int, k: int) -> int:
|
|
return factorial(n) // factorial(n - k)
|
|
|
|
def comb(n: int, k: int) -> int:
|
|
return perm(n, k) // factorial(k)
|
|
|