Returns the absolute value of self. If the keyword argument 'round' is false, do not round. The expression self.__abs__(round=False) is equivalent to self.copy_abs().
(self, round=True, context=None)
| 1087 | return ans._fix(context) |
| 1088 | |
| 1089 | def __abs__(self, round=True, context=None): |
| 1090 | """Returns the absolute value of self. |
| 1091 | |
| 1092 | If the keyword argument 'round' is false, do not round. The |
| 1093 | expression self.__abs__(round=False) is equivalent to |
| 1094 | self.copy_abs(). |
| 1095 | """ |
| 1096 | if not round: |
| 1097 | return self.copy_abs() |
| 1098 | |
| 1099 | if self._is_special: |
| 1100 | ans = self._check_nans(context=context) |
| 1101 | if ans: |
| 1102 | return ans |
| 1103 | |
| 1104 | if self._sign: |
| 1105 | ans = self.__neg__(context=context) |
| 1106 | else: |
| 1107 | ans = self.__pos__(context=context) |
| 1108 | |
| 1109 | return ans |
| 1110 | |
| 1111 | def __add__(self, other, context=None): |
| 1112 | """Returns self + other. |
no test coverage detected