O'Reilly logo

Python: Essential Reference, Third Edition by David Beazley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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() ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required