數值和數學模組¶
本章描述的模組提供了數值和數學相關的功能和資料型別。numbers
模組定義了數字型別的抽象層次結構。math
和 cmath
模組包含用於浮點數和複數的各種數學函式。decimal
模組支援使用任意精度算術精確表示十進位制數。
本章記錄了以下模組
numbers
— 數字抽象基類math
— 數學函式cmath
— 複數的數學函式decimal
— 十進位制定點和浮點算術- 快速入門教程
- Decimal 物件
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()
- 常量
- 舍入模式
- 訊號
- 浮點注意事項
- 使用執行緒
- 示例
- Decimal FAQ
fractions
— 有理數random
— 生成偽隨機數statistics
— 數學統計函式