MCPcopy Index your code
hub / github.com/python/cpython / read_unlimited

Method read_unlimited

Lib/test/test_decimal.py:282–294  ·  view source on GitHub ↗

Work around the limitations of the 32-bit _decimal version. The guaranteed maximum values for prec, Emax etc. are 425000000, but higher values usually work, except for rare corner cases. In particular, all of the IBM tests pass with maximum values of 10700

(self, v, context)

Source from the content-addressed store, hash-verified

280 'same_quantum')
281
282 def read_unlimited(self, v, context):
283 """Work around the limitations of the 32-bit _decimal version. The
284 guaranteed maximum values for prec, Emax etc. are 425000000,
285 but higher values usually work, except for rare corner cases.
286 In particular, all of the IBM tests pass with maximum values
287 of 1070000000."""
288 if self.decimal == C and self.decimal.MAX_EMAX == 425000000:
289 self.readcontext._unsafe_setprec(1070000000)
290 self.readcontext._unsafe_setemax(1070000000)
291 self.readcontext._unsafe_setemin(-1070000000)
292 return self.readcontext.create_decimal(v)
293 else:
294 return self.decimal.Decimal(v, context)
295
296 def eval_file(self, file):
297 global skip_expected

Callers 1

eval_equationMethod · 0.95

Calls 1

create_decimalMethod · 0.80

Tested by

no test coverage detected