Lines Matching defs:context
72 # Unary with optional context:
78 # Unary with optional rounding mode and context:
89 # Binary with optional context:
97 # Ternary with optional context:
110 'nullary': ('context.__hash__', 'context.__reduce__', 'context.radix'),
112 'unary': ('context.abs', 'context.canonical', 'context.copy_abs',
113 'context.copy_decimal', 'context.copy_negate',
114 'context.create_decimal', 'context.exp', 'context.is_canonical',
115 'context.is_finite', 'context.is_infinite', 'context.is_nan',
116 'context.is_normal', 'context.is_qnan', 'context.is_signed',
117 'context.is_snan', 'context.is_subnormal', 'context.is_zero',
118 'context.ln', 'context.log10', 'context.logb',
119 'context.logical_invert', 'context.minus', 'context.next_minus',
120 'context.next_plus', 'context.normalize', 'context.number_class',
121 'context.plus', 'context.sqrt', 'context.to_eng_string',
122 'context.to_integral', 'context.to_integral_exact',
123 'context.to_integral_value', 'context.to_sci_string'
126 'binary': ('context.add', 'context.compare', 'context.compare_signal',
127 'context.compare_total', 'context.compare_total_mag',
128 'context.copy_sign', 'context.divide', 'context.divide_int',
129 'context.divmod', 'context.logical_and', 'context.logical_or',
130 'context.logical_xor', 'context.max', 'context.max_mag',
131 'context.min', 'context.min_mag', 'context.multiply',
132 'context.next_toward', 'context.power', 'context.quantize',
133 'context.remainder', 'context.remainder_near', 'context.rotate',
134 'context.same_quantum', 'context.scaleb', 'context.shift',
135 'context.subtract'
138 'ternary': ('context.fma', 'context.power'),
140 'special': ('context.__reduce_ex__', 'context.create_decimal_from_float')
143 # Functions that set no context flags but whose result can differ depending
157 TernaryRestricted = ['__pow__', 'context.power']
192 """Initialization is from the C context"""
294 context = Context()
295 context.Emin = C.MIN_EMIN
296 context.Emax = C.MAX_EMAX
297 context.clear_traps()
300 # context values. We emulate this restriction for decimal.py.
311 maxcontext.traps = copy(context.p.traps)
320 return context.p._raise_error(P.InvalidOperation)
322 context.p.flags[P.FloatOperation] = True
349 If a function name is prefixed with 'context.', the corresponding
350 context method is called.
353 if funcname.startswith("context."):
354 self.funcname = funcname.replace("context.", "")
360 self.context = context # context used for the operation
372 self.maxcontext = context.c.copy()
435 p = context.p.prec
440 x = _dec_from_triple(exact._sign, '10', context.p.Emax)
443 y = _dec_from_triple(rounded._sign, '10', context.p.Emax)
448 if context.c.flags[C.Clamped] or \
449 context.c.flags[C.Underflow]:
457 dir = self.rounding_direction(x, context.p.rounding)
483 self.maxctx.prec = context.p.prec * 2
489 exact = getattr(op1, t.funcname)(op2, context=self.maxctx)
509 if context.c.flags[C.Rounded] and \
510 context.c.flags[C.Inexact] and \
511 context.p.flags[P.Rounded] and \
512 context.p.flags[P.Inexact]:
531 if context.c.flags[C.Rounded] and \
532 context.c.flags[C.Inexact] and \
533 context.p.flags[P.Rounded] and \
534 context.p.flags[P.Inexact]:
640 err += "%s\n" % str(t.context)
688 context.clear_status()
720 C.setcontext(context.c)
732 if str(c) != str(p) or not context.assert_eq_status():
746 t.context = op
767 context.clear_status()
773 t.rc = getattr(context.c, t.funcname)(*cargs)
786 t.rp = getattr(context.p, t.funcname)(*pargs)
800 not context.c.flags[C.InvalidOperation] and
801 not context.c.flags[C.Inexact] and
802 not context.c.flags[C.Rounded] and
803 not context.c.flags[C.Subnormal] and
804 not context.c.flags[C.Clamped] and
805 not context.clamp and # results are padded to context.prec if context.clamp==1.
806 not any(isinstance(v, C.Context) for v in t.cop)): # another context is used.
819 C.setcontext(context.c)
877 # The context flags must be equal.
878 if not t.context.assert_eq_status():
891 # The context flags must be equal.
892 if t.maxcontext.flags != t.context.c.flags:
901 # Loop through various context settings. The degree of
931 """Iterate a test function through many context settings."""
939 context.prec = prec
943 context.Emin = random.randrange(-1000, 0)
944 context.Emax = random.randrange(prec, 1000)
946 context.Emin, context.Emax = emin, emax
947 if prec > context.Emax: continue
949 (context.prec, context.Emin, context.Emax))
950 restr_range = 9999 if context.Emax > 9999 else context.Emax+99
952 context.rounding = rounding
953 context.capitals = random.randrange(2)
955 context.clamp = random.randrange(2)
957 context.clamp = spec['clamp']
958 exprange = context.c.Emax
1084 context.rounding = rounding
1087 op = (f,) if method.startswith("context.") else ("sNaN", f)
1137 v = v.replace("context.", "") if c_cls == C.Context else v
1273 name = 'context.powmod' if method == 'context.power' else method
1276 do_single('context.create_decimal_from_float',
1277 lambda: test_method('context.create_decimal_from_float',