python math module Detailed
In addition to floor and ceil function returns the result of the addition type is an int, float are other types of return
Import Math # 1.math.ceil (X) rounded up to integers, and built-in functions round Comparative RES = Math.ceil (2.0000023) # Note: Accuracy loss Print (RES) # . 3 # 2.math.floor (X) downwardly rounding operation, built-in functions and Comparative round RES = Math.floor (45.9123 ) Print (RES) # 45 # 3.math.pow (X, Y) calculating a value of n-th power, return type, a float # Note: the built-in the pow different functions, there is no third parameter RES = Math.pow (2,. 3 ) Print (RES) # 8.0 # 4.math.sqrt (X) square root operation, the return type of a float RES = Math.sqrt (100 ) Print (RES) # 10.0 # 5.math.fabs (X) calculates an absolute value of a number, return type, a float RES = math.fabs (-5 634 ) Print (RES) # 5634.0 # 6.math.modf (X) will be split into an integer value and two fractional part, and return to a tuple RES = math.modf (1333.99990 ) Print (RES) # (0.9999000000000251, 1333.0) # 7.math.copysign (X, Y) assigned to the symbols of the first second parameter parameter, return type a float RES = math.copysign (13 is, -66 667 ) Print (RES) # -13.0 # 8.math.fsum (Iterable) for summing data container, the return type of a float listvar = [234, 242,. 4, 2, 42 is, 42 is,. 4 ] RES = math.fsum (listvar) Print (RES) # 570.0 # 9.math.pi rate constant circumferential PI RES = Math.PI Print (RES) # 3.141592653589793