math

The math module defines the following standard mathematical functions. These functions operate on integers and floats, but don’t work with complex numbers. The return value of all functions is a float. All trigonometric functions assume the use of radians.

FunctionDescription
acos(x)Returns the arccosine of x.
asin(x)Returns the arcsine of x.
atan(x)Returns the arctangent of x.
atan2(y, x)Returns the atan(y / x).
ceil(x)Returns the ceiling of x.
cos(x)Returns the cosine of x.
cosh(x)Returns the hyperbolic cosine of x.
degrees(x)Converts x from radians to degrees.
radians(x)Converts x from degrees to radians.
exp(x)Returns e ** x.
fabs(x)Returns the absolute value of x.
floor(x)Returns the floor of x.
fmod(x, y)Returns x % y as computed by the C fmod() ...

Get Python: Essential Reference, Third Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.