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 :

Classe « Decimal » Python 3.11.3

Méthode statistics.Decimal.remainder_near

Signature de la méthode remainder_near

def remainder_near(self, /, other, context=None) 

Description

help(Decimal.remainder_near)

Return the remainder from dividing self by other.  This differs from
self % other in that the sign of the remainder is chosen so as to minimize
its absolute value. More precisely, the return value is self - n * other
where n is the integer nearest to the exact value of self / other, and
if two integers are equally near then the even one is chosen.

If the result is zero then its sign will be the sign of self.