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