Returns the minimum representable value in this data type. Raises: TypeError: if this is a non-numeric, unordered, or quantized type.
(self)
| 175 | |
| 176 | @property |
| 177 | def min(self): |
| 178 | """Returns the minimum representable value in this data type. |
| 179 | |
| 180 | Raises: |
| 181 | TypeError: if this is a non-numeric, unordered, or quantized type. |
| 182 | |
| 183 | """ |
| 184 | if (self.is_quantized or |
| 185 | self.base_dtype in (bool, string, complex64, complex128)): |
| 186 | raise TypeError("Cannot find minimum value of %s." % self) |
| 187 | |
| 188 | # there is no simple way to get the min value of a dtype, we have to check |
| 189 | # float and int types separately |
| 190 | try: |
| 191 | return np.finfo(self.as_numpy_dtype()).min |
| 192 | except: # bare except as possible raises by finfo not documented |
| 193 | try: |
| 194 | return np.iinfo(self.as_numpy_dtype()).min |
| 195 | except: |
| 196 | if self.base_dtype == bfloat16: |
| 197 | return _np_bfloat16(float.fromhex("-0x1.FEp127")) |
| 198 | raise TypeError("Cannot find minimum value of %s." % self) |
| 199 | |
| 200 | @property |
| 201 | def max(self): |