Participer au site avec un Tip
Rechercher
 

Améliorations / Corrections

Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.

Emplacement :

Description des améliorations :

Module « statistics » Python 3.11.3

Classe « Decimal »

Informations générales

Héritage

builtins.object
    Decimal

Définition

class Decimal(builtins.object):

help(Decimal)

Construct a new Decimal object. 'value' can be an integer, string, tuple,
or another Decimal object. If no value is given, return Decimal('0'). The
context does not affect the conversion and is only passed to determine if
the InvalidOperation trap is active.

Constructeur(s)

Signature du constructeur Description
__new__(*args, **kwargs) Create and return a new object. See help(type) for accurate signature. [extrait de __new__.__doc__]
__init__(self, /, *args, **kwargs) Initialize self. See help(type(self)) for accurate signature. [extrait de __init__.__doc__]

Liste des attributs statiques

Nom de l'attribut Valeur
imag<attribute 'imag' of 'decimal.Decimal' objects>
real<attribute 'real' of 'decimal.Decimal' objects>

Liste des opérateurs

Signature de l'opérateur Description
__add__(self, value) Return self+value. [extrait de __add__.__doc__]
__eq__(self, value) Return self==value. [extrait de __eq__.__doc__]
__floordiv__(self, value) Return self//value. [extrait de __floordiv__.__doc__]
__ge__(self, value) Return self>=value. [extrait de __ge__.__doc__]
__gt__(self, value) Return self>value. [extrait de __gt__.__doc__]
__le__(self, value) Return self<=value. [extrait de __le__.__doc__]
__lt__(self, value) Return self<value. [extrait de __lt__.__doc__]
__mod__(self, value) Return self%value. [extrait de __mod__.__doc__]
__mul__(self, value) Return self*value. [extrait de __mul__.__doc__]
__ne__(self, value) Return self!=value. [extrait de __ne__.__doc__]
__neg__(self) -self [extrait de __neg__.__doc__]
__pos__(self) +self [extrait de __pos__.__doc__]
__pow__(self, value, mod=None) Return pow(self, value, mod). [extrait de __pow__.__doc__]
__radd__(self, value) Return value+self. [extrait de __radd__.__doc__]
__rfloordiv__(self, value) Return value//self. [extrait de __rfloordiv__.__doc__]
__rmod__(self, value) Return value%self. [extrait de __rmod__.__doc__]
__rmul__(self, value) Return value*self. [extrait de __rmul__.__doc__]
__rpow__(self, value, mod=None) Return pow(value, self, mod). [extrait de __rpow__.__doc__]
__rsub__(self, value) Return value-self. [extrait de __rsub__.__doc__]
__rtruediv__(self, value) Return value/self. [extrait de __rtruediv__.__doc__]
__sub__(self, value) Return self-value. [extrait de __sub__.__doc__]
__truediv__(self, value) Return self/value. [extrait de __truediv__.__doc__]

Liste des méthodes

Toutes les méthodes Méthodes d'instance Méthodes statiques Méthodes dépréciées
Signature de la méthodeDescription
__abs__(self) abs(self) [extrait de __abs__.__doc__]
__bool__(self) True if self else False [extrait de __bool__.__doc__]
__ceil__
__complex__
__copy__
__deepcopy__
__divmod__(self, value) Return divmod(self, value). [extrait de __divmod__.__doc__]
__float__(self) float(self) [extrait de __float__.__doc__]
__floor__
__format__
__getattribute__(self, name) Return getattr(self, name). [extrait de __getattribute__.__doc__]
__hash__(self) Return hash(self). [extrait de __hash__.__doc__]
__int__(self) int(self) [extrait de __int__.__doc__]
__rdivmod__(self, value) Return divmod(value, self). [extrait de __rdivmod__.__doc__]
__reduce__
__repr__(self) Return repr(self). [extrait de __repr__.__doc__]
__round__
__sizeof__
__str__(self) Return str(self). [extrait de __str__.__doc__]
__trunc__
adjusted(self) Return the adjusted exponent of the number. Defined as exp + digits - 1. [extrait de adjusted.__doc__]
as_integer_ratio(self) Decimal.as_integer_ratio() -> (int, int) [extrait de as_integer_ratio.__doc__]
as_tuple(self) Return a tuple representation of the number. [extrait de as_tuple.__doc__]
canonical(self) Return the canonical encoding of the argument. Currently, the encoding [extrait de canonical.__doc__]
compare(self, /, other, context=None) Compare self to other. Return a decimal value: [extrait de compare.__doc__]
compare_signal(self, /, other, context=None) Identical to compare, except that all NaNs signal. [extrait de compare_signal.__doc__]
compare_total(self, /, other, context=None) Compare two operands using their abstract representation rather than [extrait de compare_total.__doc__]
compare_total_mag(self, /, other, context=None) Compare two operands using their abstract representation rather than their [extrait de compare_total_mag.__doc__]
conjugate(self) Return self. [extrait de conjugate.__doc__]
copy_abs(self) Return the absolute value of the argument. This operation is unaffected by [extrait de copy_abs.__doc__]
copy_negate(self) Return the negation of the argument. This operation is unaffected by context [extrait de copy_negate.__doc__]
copy_sign(self, /, other, context=None) Return a copy of the first operand with the sign set to be the same as the [extrait de copy_sign.__doc__]
exp(self, /, context=None) Return the value of the (natural) exponential function e**x at the given [extrait de exp.__doc__]
fma(self, /, other, third, context=None) Fused multiply-add. Return self*other+third with no rounding of the [extrait de fma.__doc__]
from_float(f) Class method that converts a float to a decimal number, exactly. [extrait de from_float.__doc__]
is_canonical(self) Return True if the argument is canonical and False otherwise. Currently, [extrait de is_canonical.__doc__]
is_finite(self) Return True if the argument is a finite number, and False if the argument [extrait de is_finite.__doc__]
is_infinite(self) Return True if the argument is either positive or negative infinity and [extrait de is_infinite.__doc__]
is_nan(self) Return True if the argument is a (quiet or signaling) NaN and False [extrait de is_nan.__doc__]
is_normal(self, /, context=None) Return True if the argument is a normal finite non-zero number with an [extrait de is_normal.__doc__]
is_qnan(self) Return True if the argument is a quiet NaN, and False otherwise. [extrait de is_qnan.__doc__]
is_signed(self) Return True if the argument has a negative sign and False otherwise. [extrait de is_signed.__doc__]
is_snan(self) Return True if the argument is a signaling NaN and False otherwise. [extrait de is_snan.__doc__]
is_subnormal(self, /, context=None) Return True if the argument is subnormal, and False otherwise. A number is [extrait de is_subnormal.__doc__]
is_zero(self) Return True if the argument is a (positive or negative) zero and False [extrait de is_zero.__doc__]
ln(self, /, context=None) Return the natural (base e) logarithm of the operand. The function always [extrait de ln.__doc__]
log10(self, /, context=None) Return the base ten logarithm of the operand. The function always uses the [extrait de log10.__doc__]
logb(self, /, context=None) For a non-zero number, return the adjusted exponent of the operand as a [extrait de logb.__doc__]
logical_and(self, /, other, context=None) Return the digit-wise 'and' of the two (logical) operands. [extrait de logical_and.__doc__]
logical_invert(self, /, context=None) Return the digit-wise inversion of the (logical) operand. [extrait de logical_invert.__doc__]
logical_or(self, /, other, context=None) Return the digit-wise 'or' of the two (logical) operands. [extrait de logical_or.__doc__]
logical_xor(self, /, other, context=None) Return the digit-wise 'exclusive or' of the two (logical) operands. [extrait de logical_xor.__doc__]
max(self, /, other, context=None) Maximum of self and other. If one operand is a quiet NaN and the other is [extrait de max.__doc__]
max_mag(self, /, other, context=None) Similar to the max() method, but the comparison is done using the absolute [extrait de max_mag.__doc__]
min(self, /, other, context=None) Minimum of self and other. If one operand is a quiet NaN and the other is [extrait de min.__doc__]
min_mag(self, /, other, context=None) Similar to the min() method, but the comparison is done using the absolute [extrait de min_mag.__doc__]
next_minus(self, /, context=None) Return the largest number representable in the given context (or in the [extrait de next_minus.__doc__]
next_plus(self, /, context=None) Return the smallest number representable in the given context (or in the [extrait de next_plus.__doc__]
next_toward(self, /, other, context=None) If the two operands are unequal, return the number closest to the first [extrait de next_toward.__doc__]
normalize(self, /, context=None) Normalize the number by stripping the rightmost trailing zeros and [extrait de normalize.__doc__]
number_class(self, /, context=None) Return a string describing the class of the operand. The returned value [extrait de number_class.__doc__]
quantize(self, /, exp, rounding=None, context=None) Return a value equal to the first operand after rounding and having the [extrait de quantize.__doc__]
radix(self) Return Decimal(10), the radix (base) in which the Decimal class does [extrait de radix.__doc__]
remainder_near(self, /, other, context=None) Return the remainder from dividing self by other. This differs from [extrait de remainder_near.__doc__]
rotate(self, /, other, context=None) Return the result of rotating the digits of the first operand by an amount [extrait de rotate.__doc__]
same_quantum(self, /, other, context=None) Test whether self and other have the same exponent or whether both are NaN. [extrait de same_quantum.__doc__]
scaleb(self, /, other, context=None) Return the first operand with the exponent adjusted the second. Equivalently, [extrait de scaleb.__doc__]
shift(self, /, other, context=None) Return the result of shifting the digits of the first operand by an amount [extrait de shift.__doc__]
sqrt(self, /, context=None) Return the square root of the argument to full precision. The result is [extrait de sqrt.__doc__]
to_eng_string(self, /, context=None) Convert to an engineering-type string. Engineering notation has an exponent [extrait de to_eng_string.__doc__]
to_integral(self, /, rounding=None, context=None) Identical to the to_integral_value() method. The to_integral() name has been [extrait de to_integral.__doc__]
to_integral_exact(self, /, rounding=None, context=None) Round to the nearest integer, signaling Inexact or Rounded as appropriate if [extrait de to_integral_exact.__doc__]
to_integral_value(self, /, rounding=None, context=None) Round to the nearest integer without signaling Inexact or Rounded. The [extrait de to_integral_value.__doc__]

Méthodes héritées de la classe object

__delattr__, __dir__, __getstate__, __init_subclass__, __reduce_ex__, __setattr__, __subclasshook__