MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / __pos__

Method __pos__

tools/python-3.11.9-amd64/Lib/_pydecimal.py:1124–1143  ·  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

1122 return ans._fix(context)
1123
1124 def __pos__(self, context=None):
1125 """Returns a copy, unless it is a sNaN.
1126
1127 Rounds the number (if more than precision digits)
1128 """
1129 if self._is_special:
1130 ans = self._check_nans(context=context)
1131 if ans:
1132 return ans
1133
1134 if context is None:
1135 context = getcontext()
1136
1137 if not self and context.rounding != ROUND_FLOOR:
1138 # + (-0) = 0, except in ROUND_FLOOR rounding mode.
1139 ans = self.copy_abs()
1140 else:
1141 ans = Decimal(self)
1142
1143 return ans._fix(context)
1144
1145 def __abs__(self, round=True, context=None):
1146 """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