Returns an indication of the class of the operand. The class is one of the following strings: -sNaN -NaN -Infinity -Normal -Subnormal -Zero +Zero +Subnormal +Normal +Infinity >>> c =
(self, a)
| 5050 | return a.normalize(context=self) |
| 5051 | |
| 5052 | def number_class(self, a): |
| 5053 | """Returns an indication of the class of the operand. |
| 5054 | |
| 5055 | The class is one of the following strings: |
| 5056 | -sNaN |
| 5057 | -NaN |
| 5058 | -Infinity |
| 5059 | -Normal |
| 5060 | -Subnormal |
| 5061 | -Zero |
| 5062 | +Zero |
| 5063 | +Subnormal |
| 5064 | +Normal |
| 5065 | +Infinity |
| 5066 | |
| 5067 | >>> c = ExtendedContext.copy() |
| 5068 | >>> c.Emin = -999 |
| 5069 | >>> c.Emax = 999 |
| 5070 | >>> c.number_class(Decimal('Infinity')) |
| 5071 | '+Infinity' |
| 5072 | >>> c.number_class(Decimal('1E-10')) |
| 5073 | '+Normal' |
| 5074 | >>> c.number_class(Decimal('2.50')) |
| 5075 | '+Normal' |
| 5076 | >>> c.number_class(Decimal('0.1E-999')) |
| 5077 | '+Subnormal' |
| 5078 | >>> c.number_class(Decimal('0')) |
| 5079 | '+Zero' |
| 5080 | >>> c.number_class(Decimal('-0')) |
| 5081 | '-Zero' |
| 5082 | >>> c.number_class(Decimal('-0.1E-999')) |
| 5083 | '-Subnormal' |
| 5084 | >>> c.number_class(Decimal('-1E-10')) |
| 5085 | '-Normal' |
| 5086 | >>> c.number_class(Decimal('-2.50')) |
| 5087 | '-Normal' |
| 5088 | >>> c.number_class(Decimal('-Infinity')) |
| 5089 | '-Infinity' |
| 5090 | >>> c.number_class(Decimal('NaN')) |
| 5091 | 'NaN' |
| 5092 | >>> c.number_class(Decimal('-NaN')) |
| 5093 | 'NaN' |
| 5094 | >>> c.number_class(Decimal('sNaN')) |
| 5095 | 'sNaN' |
| 5096 | >>> c.number_class(123) |
| 5097 | '+Normal' |
| 5098 | """ |
| 5099 | a = _convert_other(a, raiseit=True) |
| 5100 | return a.number_class(context=self) |
| 5101 | |
| 5102 | def plus(self, a): |
| 5103 | """Plus corresponds to unary prefix plus in Python. |