数值和数学模块 ¶
此章描述的模块提供数值和数学相关函数、数据类型。
numbers
模块定义数值类型的抽象层次结构。
math
and
cmath
模块包含各种用于浮点数和复数的数学函数。
decimal
模块支持十进制数的准确表示,使用任意精度算术。
本章文档化了以下模块:
-
numbers— 数值抽象基类 -
math— 数学函数 -
cmath— 用于复数的数学函数 -
decimal— Decimal fixed-point and floating-point arithmetic- 快速入门教程
-
十进制对象
-
Decimal-
adjusted() -
as_integer_ratio() -
as_tuple() -
canonical() -
compare() -
compare_signal() -
compare_total() -
compare_total_mag() -
conjugate() -
copy_abs() -
copy_negate() -
copy_sign() -
exp() -
from_float() -
fma() -
is_canonical() -
is_finite() -
is_infinite() -
is_nan() -
is_normal() -
is_qnan() -
is_signed() -
is_snan() -
is_subnormal() -
is_zero() -
ln() -
log10() -
logb() -
logical_and() -
logical_invert() -
logical_or() -
logical_xor() -
max() -
max_mag() -
min() -
min_mag() -
next_minus() -
next_plus() -
next_toward() -
normalize() -
number_class() -
quantize() -
radix() -
remainder_near() -
rotate() -
same_quantum() -
scaleb() -
shift() -
sqrt() -
to_eng_string() -
to_integral() -
to_integral_exact() -
to_integral_value()
-
- 逻辑操作数
-
-
上下文对象
-
getcontext() -
setcontext() -
localcontext() -
BasicContext -
ExtendedContext -
DefaultContext -
Context-
clear_flags() -
clear_traps() -
copy() -
copy_decimal() -
create_decimal() -
create_decimal_from_float() -
Etiny() -
Etop() -
abs() -
add() -
canonical() -
compare() -
compare_signal() -
compare_total() -
compare_total_mag() -
copy_abs() -
copy_negate() -
copy_sign() -
divide() -
divide_int() -
divmod() -
exp() -
fma() -
is_canonical() -
is_finite() -
is_infinite() -
is_nan() -
is_normal() -
is_qnan() -
is_signed() -
is_snan() -
is_subnormal() -
is_zero() -
ln() -
log10() -
logb() -
logical_and() -
logical_invert() -
logical_or() -
logical_xor() -
max() -
max_mag() -
min() -
min_mag() -
minus() -
multiply() -
next_minus() -
next_plus() -
next_toward() -
normalize() -
number_class() -
plus() -
power() -
quantize() -
radix() -
remainder() -
remainder_near() -
rotate() -
same_quantum() -
scaleb() -
shift() -
sqrt() -
subtract() -
to_eng_string() -
to_integral_exact() -
to_sci_string()
-
-
- 常量
- 舍入模式
- 信号
- Floating-Point Notes
- 操控线程
- 配方
- 十进制 FAQ
-
fractions— 有理数 -
random— 生成伪随机数 -
statistics— 数学统计函数