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

Method bin_resolve_ulp

Modules/_decimal/tests/deccheck.py:475–495  ·  view source on GitHub ↗

Check if results of _decimal's power function are within the allowed ulp ranges.

(self, t)

Source from the content-addressed store, hash-verified

473 return False
474
475 def bin_resolve_ulp(self, t):
476 """Check if results of _decimal's power function are within the
477 allowed ulp ranges."""
478 # NaNs are beyond repair.
479 if t.rc.is_nan() or t.rp.is_nan():
480 return False
481
482 # "exact" result, double precision, half_even
483 self.maxctx.prec = context.p.prec * 2
484
485 op1, op2 = t.pop[0], t.pop[1]
486 if t.contextfunc:
487 exact = getattr(self.maxctx, t.funcname)(op1, op2)
488 else:
489 exact = getattr(op1, t.funcname)(op2, context=self.maxctx)
490
491 # _decimal's rounded result
492 rounded = P.Decimal(t.cresults[0])
493
494 self.ulpdiff += 1
495 return self.check_ulpdiff(exact, rounded)
496
497 ############################ Correct rounding #############################
498 def resolve_underflow(self, t):

Callers 1

__pow__Method · 0.95

Calls 2

check_ulpdiffMethod · 0.95
is_nanMethod · 0.45

Tested by

no test coverage detected