MCPcopy Index your code
hub / github.com/RustPython/RustPython / __pos__

Method __pos__

Lib/_pydecimal.py:1065–1084  ·  view source on GitHub ↗

Returns a copy, unless it is a sNaN. Rounds the number (if more than precision digits)

(self, context=None)

Source from the content-addressed store, hash-verified

1063 return ans._fix(context)
1064
1065 def __pos__(self, context=None):
1066 """Returns a copy, unless it is a sNaN.
1067
1068 Rounds the number (if more than precision digits)
1069 """
1070 if self._is_special:
1071 ans = self._check_nans(context=context)
1072 if ans:
1073 return ans
1074
1075 if context is None:
1076 context = getcontext()
1077
1078 if not self and context.rounding != ROUND_FLOOR:
1079 # + (-0) = 0, except in ROUND_FLOOR rounding mode.
1080 ans = self.copy_abs()
1081 else:
1082 ans = Decimal(self)
1083
1084 return ans._fix(context)
1085
1086 def __abs__(self, round=True, context=None):
1087 """Returns the absolute value of self.

Callers 2

__abs__Method · 0.95
plusMethod · 0.45

Calls 5

_check_nansMethod · 0.95
copy_absMethod · 0.95
_fixMethod · 0.95
getcontextFunction · 0.85
DecimalClass · 0.85

Tested by

no test coverage detected