Math¶
No import is needed.
Read the usage guide for examples and common tasks. This reference lists the public declarations for this part of the library. See Reading API signatures for parameter and result notation.
Math¶
Common mathematical operations on double-precision numbers. Trigonometric arguments and results use radians.
floor¶
Rounds x down to the nearest integer value.
ceil¶
Rounds x up to the nearest integer value.
round¶
Rounds x to the nearest integer value. Halfway cases round away from zero, so round(2.5) is 3 and round(-2.5) is -3.
sqrt¶
Square root, correctly rounded. A negative input is NaN.
pow¶
Returns base raised to exponent. A negative base with a non-integer exponent is NaN, and pow(x, 0) is 1 for every x, including NaN.
sin¶
Returns the sine of x, measured in radians.
cos¶
Returns the cosine of x, measured in radians.
tan¶
Returns the tangent of x, measured in radians.
asin¶
Returns the inverse sine in radians; inputs outside [-1, 1] produce NaN.
acos¶
Returns the inverse cosine in radians; inputs outside [-1, 1] produce NaN.
atan¶
Returns the inverse tangent in radians.
atan2¶
Returns the angle of the point (x, y) in radians, using both signs to choose the quadrant.
log¶
Returns the natural logarithm of x. Zero gives negative infinity and a negative input gives NaN.
log10¶
Returns the base-ten logarithm of x. Zero gives negative infinity and a negative input gives NaN.
exp¶
Returns e raised to x.
hypot¶
Returns the length of the vector (x, y) without overflow or underflow in the intermediate squares. An infinite component gives infinity even when the other is NaN.
PI¶
Ratio of a circle's circumference to its diameter.
E¶
Base of the natural logarithm.