6. Numeric and Mathematical Modules

#
6. Numeric and Mathematical Modules

The modules described in this chapter provide numeric and math-related functions and data types. The `math` and `cmath` contain various mathematical functions for floating-point and complex numbers. For users more interested in decimal accuracy than in speed, the `decimal` module supports exact representations of decimal numbers.

The following modules are documented in this chapter:

`math` |  | Mathematical functions (`sin()` etc.).
`cmath` |  | Mathematical functions for complex numbers.
`decimal` |  | Implementation of the General Decimal Arithmetic Specification.
`random` |  | Generate pseudo-random numbers with various common distributions.
`itertools` |  | Functions creating iterators for efficient looping.
`functools` |  | Higher-order functions and operations on callable objects.
`operator` |  | All Python's standard operators as built-in functions.