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

Method _set_rounding

Lib/_pydecimal.py:4056–4073  ·  view source on GitHub ↗

Sets the rounding type. Sets the rounding type, and returns the current (previous) rounding type. Often used like: context = context.copy() # so you don't change the calling context # if an error occurs in the middle. rounding = context._set_roundin

(self, type)

Source from the content-addressed store, hash-verified

4054 return int(self.Emax - self.prec + 1)
4055
4056 def _set_rounding(self, type):
4057 """Sets the rounding type.
4058
4059 Sets the rounding type, and returns the current (previous)
4060 rounding type. Often used like:
4061
4062 context = context.copy()
4063 # so you don't change the calling context
4064 # if an error occurs in the middle.
4065 rounding = context._set_rounding(ROUND_UP)
4066 val = self.__sub__(other, context=context)
4067 context._set_rounding(rounding)
4068
4069 This will make it round up for that operation.
4070 """
4071 rounding = self.rounding
4072 self.rounding = type
4073 return rounding
4074
4075 def create_decimal(self, num='0'):
4076 """Creates a new Decimal instance but using self as context.

Callers 6

sqrtMethod · 0.80
expMethod · 0.80
lnMethod · 0.80
log10Method · 0.80
next_minusMethod · 0.80
next_plusMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected