Compares two operands using their abstract representation. This is not like the standard compare, which use their numerical value. Note that a total ordering is defined for all possible abstract representations. >>> ExtendedContext.compare_total(Decimal('12.73'), De
(self, a, b)
| 4237 | return a.compare_signal(b, context=self) |
| 4238 | |
| 4239 | def compare_total(self, a, b): |
| 4240 | """Compares two operands using their abstract representation. |
| 4241 | |
| 4242 | This is not like the standard compare, which use their numerical |
| 4243 | value. Note that a total ordering is defined for all possible abstract |
| 4244 | representations. |
| 4245 | |
| 4246 | >>> ExtendedContext.compare_total(Decimal('12.73'), Decimal('127.9')) |
| 4247 | Decimal('-1') |
| 4248 | >>> ExtendedContext.compare_total(Decimal('-127'), Decimal('12')) |
| 4249 | Decimal('-1') |
| 4250 | >>> ExtendedContext.compare_total(Decimal('12.30'), Decimal('12.3')) |
| 4251 | Decimal('-1') |
| 4252 | >>> ExtendedContext.compare_total(Decimal('12.30'), Decimal('12.30')) |
| 4253 | Decimal('0') |
| 4254 | >>> ExtendedContext.compare_total(Decimal('12.3'), Decimal('12.300')) |
| 4255 | Decimal('1') |
| 4256 | >>> ExtendedContext.compare_total(Decimal('12.3'), Decimal('NaN')) |
| 4257 | Decimal('-1') |
| 4258 | >>> ExtendedContext.compare_total(1, 2) |
| 4259 | Decimal('-1') |
| 4260 | >>> ExtendedContext.compare_total(Decimal(1), 2) |
| 4261 | Decimal('-1') |
| 4262 | >>> ExtendedContext.compare_total(1, Decimal(2)) |
| 4263 | Decimal('-1') |
| 4264 | """ |
| 4265 | a = _convert_other(a, raiseit=True) |
| 4266 | return a.compare_total(b) |
| 4267 | |
| 4268 | def compare_total_mag(self, a, b): |
| 4269 | """Compares two operands using their abstract representation ignoring sign. |