Numeric and Mathematical Modules数字和数学模块¶
The modules described in this chapter provide numeric and math-related functions and data types. 本章介绍的模块提供了与数值和数学相关的函数和数据类型。The numbers
module defines an abstract hierarchy of numeric types. numbers
模块定义了数字类型的抽象层次结构。The math
and cmath
modules contain various mathematical functions for floating-point and complex numbers. math
和cmath
模块包含浮点数和复数的各种数学函数。The decimal
module supports exact representations of decimal numbers, using arbitrary precision arithmetic.decimal
模块支持使用任意精度算术精确表示十进制数。
The following modules are documented in this chapter:本章记录了以下模块:
numbers
—Numeric abstract base classes数字抽象基类math
—Mathematical functions数学函数cmath
—Mathematical functions for complex numbers复数的数学函数decimal
—Decimal fixed point and floating point arithmetic十进制定点和浮点运算fractions
—Rational numbers有理数random
—Generate pseudo-random numbers生成伪随机数statistics
—Mathematical statistics functions数理统计函数