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. The math
and cmath
modules contain various
mathematical functions for floating-point and complex numbers. The decimal
module supports exact representations of decimal numbers, using arbitrary precision
arithmetic.
The following modules are documented in this chapter:
numbers
— Numeric abstract base classesmath
— Mathematical functionscmath
— Mathematical functions for complex numbersdecimal
— Decimal fixed point and floating point arithmetic- Quick-start Tutorial
- Decimal objects
Decimal
Decimal.adjusted()
Decimal.as_integer_ratio()
Decimal.as_tuple()
Decimal.canonical()
Decimal.compare()
Decimal.compare_signal()
Decimal.compare_total()
Decimal.compare_total_mag()
Decimal.conjugate()
Decimal.copy_abs()
Decimal.copy_negate()
Decimal.copy_sign()
Decimal.exp()
Decimal.from_float()
Decimal.fma()
Decimal.is_canonical()
Decimal.is_finite()
Decimal.is_infinite()
Decimal.is_nan()
Decimal.is_normal()
Decimal.is_qnan()
Decimal.is_signed()
Decimal.is_snan()
Decimal.is_subnormal()
Decimal.is_zero()
Decimal.ln()
Decimal.log10()
Decimal.logb()
Decimal.logical_and()
Decimal.logical_invert()
Decimal.logical_or()
Decimal.logical_xor()
Decimal.max()
Decimal.max_mag()
Decimal.min()
Decimal.min_mag()
Decimal.next_minus()
Decimal.next_plus()
Decimal.next_toward()
Decimal.normalize()
Decimal.number_class()
Decimal.quantize()
Decimal.radix()
Decimal.remainder_near()
Decimal.rotate()
Decimal.same_quantum()
Decimal.scaleb()
Decimal.shift()
Decimal.sqrt()
Decimal.to_eng_string()
Decimal.to_integral()
Decimal.to_integral_exact()
Decimal.to_integral_value()
- Logical operands
- Context objects
getcontext()
setcontext()
localcontext()
BasicContext
ExtendedContext
DefaultContext
Context
Context.clear_flags()
Context.clear_traps()
Context.copy()
Context.copy_decimal()
Context.create_decimal()
Context.create_decimal_from_float()
Context.Etiny()
Context.Etop()
Context.abs()
Context.add()
Context.canonical()
Context.compare()
Context.compare_signal()
Context.compare_total()
Context.compare_total_mag()
Context.copy_abs()
Context.copy_negate()
Context.copy_sign()
Context.divide()
Context.divide_int()
Context.divmod()
Context.exp()
Context.fma()
Context.is_canonical()
Context.is_finite()
Context.is_infinite()
Context.is_nan()
Context.is_normal()
Context.is_qnan()
Context.is_signed()
Context.is_snan()
Context.is_subnormal()
Context.is_zero()
Context.ln()
Context.log10()
Context.logb()
Context.logical_and()
Context.logical_invert()
Context.logical_or()
Context.logical_xor()
Context.max()
Context.max_mag()
Context.min()
Context.min_mag()
Context.minus()
Context.multiply()
Context.next_minus()
Context.next_plus()
Context.next_toward()
Context.normalize()
Context.number_class()
Context.plus()
Context.power()
Context.quantize()
Context.radix()
Context.remainder()
Context.remainder_near()
Context.rotate()
Context.same_quantum()
Context.scaleb()
Context.shift()
Context.sqrt()
Context.subtract()
Context.to_eng_string()
Context.to_integral_exact()
Context.to_sci_string()
- Constants
- Rounding modes
- Signals
- Floating Point Notes
- Working with threads
- Recipes
- Decimal FAQ
fractions
— Rational numbersrandom
— Generate pseudo-random numbersstatistics
— Mathematical statistics functions