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)
| 3598 | return ans |
| 3599 | |
| 3600 | def number_class(self, context=None): |
| 3601 | """Returns an indication of the class of self. |
| 3602 | |
| 3603 | The class is one of the following strings: |
| 3604 | sNaN |
| 3605 | NaN |
| 3606 | -Infinity |
| 3607 | -Normal |
| 3608 | -Subnormal |
| 3609 | -Zero |
| 3610 | +Zero |
| 3611 | +Subnormal |
| 3612 | +Normal |
| 3613 | +Infinity |
| 3614 | """ |
| 3615 | if self.is_snan(): |
| 3616 | return "sNaN" |
| 3617 | if self.is_qnan(): |
| 3618 | return "NaN" |
| 3619 | inf = self._isinfinity() |
| 3620 | if inf == 1: |
| 3621 | return "+Infinity" |
| 3622 | if inf == -1: |
| 3623 | return "-Infinity" |
| 3624 | if self.is_zero(): |
| 3625 | if self._sign: |
| 3626 | return "-Zero" |
| 3627 | else: |
| 3628 | return "+Zero" |
| 3629 | if context is None: |
| 3630 | context = getcontext() |
| 3631 | if self.is_subnormal(context=context): |
| 3632 | if self._sign: |
| 3633 | return "-Subnormal" |
| 3634 | else: |
| 3635 | return "+Subnormal" |
| 3636 | # just a normal, regular, boring number, :) |
| 3637 | if self._sign: |
| 3638 | return "-Normal" |
| 3639 | else: |
| 3640 | return "+Normal" |
| 3641 | |
| 3642 | def radix(self): |
| 3643 | """Just returns 10, as this is Decimal, :)""" |
no test coverage detected