Returns an indication of the class of self. The class is one of the following strings: sNaN NaN -Infinity -Normal -Subnormal -Zero +Zero +Subnormal +Normal +Infinity
(self, context=None)
| 3562 | return ans |
| 3563 | |
| 3564 | def number_class(self, context=None): |
| 3565 | """Returns an indication of the class of self. |
| 3566 | |
| 3567 | The class is one of the following strings: |
| 3568 | sNaN |
| 3569 | NaN |
| 3570 | -Infinity |
| 3571 | -Normal |
| 3572 | -Subnormal |
| 3573 | -Zero |
| 3574 | +Zero |
| 3575 | +Subnormal |
| 3576 | +Normal |
| 3577 | +Infinity |
| 3578 | """ |
| 3579 | if self.is_snan(): |
| 3580 | return "sNaN" |
| 3581 | if self.is_qnan(): |
| 3582 | return "NaN" |
| 3583 | inf = self._isinfinity() |
| 3584 | if inf == 1: |
| 3585 | return "+Infinity" |
| 3586 | if inf == -1: |
| 3587 | return "-Infinity" |
| 3588 | if self.is_zero(): |
| 3589 | if self._sign: |
| 3590 | return "-Zero" |
| 3591 | else: |
| 3592 | return "+Zero" |
| 3593 | if context is None: |
| 3594 | context = getcontext() |
| 3595 | if self.is_subnormal(context=context): |
| 3596 | if self._sign: |
| 3597 | return "-Subnormal" |
| 3598 | else: |
| 3599 | return "+Subnormal" |
| 3600 | # just a normal, regular, boring number, :) |
| 3601 | if self._sign: |
| 3602 | return "-Normal" |
| 3603 | else: |
| 3604 | return "+Normal" |
| 3605 | |
| 3606 | def radix(self): |
| 3607 | """Just returns 10, as this is Decimal, :)""" |