Lines Matching refs:sign

145     DecimalTuple = _namedtuple('DecimalTuple', 'sign digits exponent')
216 also a quiet NaN, but with the original sign, and an optional
243 The result of the operation is [sign,inf], where sign is the exclusive
248 def handle(self, context, sign, *args):
249 return _SignedInfinity[sign]
333 round-up, if implemented), the result of the operation is [sign,inf],
334 where sign is the sign of the intermediate result. For round-down, the
336 current precision, with the sign of the intermediate result. For
337 round-ceiling, the result is the same as for round-down if the sign of
339 the result is the same as for round-down if the sign of the intermediate
344 def handle(self, context, sign, *args):
347 return _SignedInfinity[sign]
348 if sign == 0:
350 return _SignedInfinity[sign]
351 return _dec_from_triple(sign, '9'*context.prec,
353 if sign == 1:
355 return _SignedInfinity[sign]
356 return _dec_from_triple(sign, '9'*context.prec,
370 in 0 with the sign of the intermediate result and an exponent of Etiny.
520 >>> Decimal((0, (3, 1, 4), -2)) # tuple (sign, digit_tuple, exponent)
550 if m.group('sign') == "-":
599 self._sign = value.sign
611 # process sign. The isinstance test rejects floats
613 raise ValueError("Invalid sign. The first value in the tuple "
688 sign = 0
690 sign = 1
693 result = _dec_from_triple(sign, str(n*5**k), -k)
975 # have the same sign, and (ii) n is congruent to m modulo
978 return hash((-1)**op.sign*op.int*pow(10, op.exp, 2**64-1))
980 # faithfully represented by the triple consisting of its sign,
1005 sign = ['', '-'][self._sign]
1008 return sign + 'Infinity'
1010 return sign + 'NaN' + self._int
1012 return sign + 'sNaN' + self._int
1049 return sign + intpart + fracpart + exp
1062 """Returns a copy with the sign switched.
1144 # If both INF, same sign => same as both, opposite => error.
1154 # If the answer is 0, the sign should be negative, in this case.
1158 sign = min(self._sign, other._sign)
1160 sign = 1
1161 ans = _dec_from_triple(sign, '0', exp)
1180 if op1.sign != op2.sign:
1189 if op1.sign == 1:
1190 result.sign = 1
1191 op1.sign, op2.sign = op2.sign, op1.sign
1193 result.sign = 0
1194 # So we know the sign, and op1 > 0.
1195 elif op1.sign == 1:
1196 result.sign = 1
1197 op1.sign, op2.sign = (0, 0)
1199 result.sign = 0
1202 if op2.sign == 0:
1302 sign = self._sign ^ other._sign
1313 return _SignedInfinity[sign]
1317 return _dec_from_triple(sign, '0', context.Etiny())
1323 return context._raise_error(DivisionByZero, 'x / 0', sign)
1349 ans = _dec_from_triple(sign, str(coeff), exp)
1358 sign = self._sign ^ other._sign
1366 return (_dec_from_triple(sign, '0', 0),
1377 return (_dec_from_triple(sign, str(q), 0),
1410 sign = self._sign ^ other._sign
1416 return (_SignedInfinity[sign],
1424 return (context._raise_error(DivisionByZero, 'x // 0', sign),
1538 # result has same sign as self unless r is negative
1539 sign = self._sign
1541 sign = 1-sign
1544 ans = _dec_from_triple(sign, str(r), ideal_exponent)
1917 # compute sign of result
1919 sign = 0
1921 sign = self._sign
1935 return _dec_from_triple(sign, str(base), 0)
2018 if y.sign == 1:
2030 if y.sign == 1:
2220 # result has sign 1 iff self._sign is 1 and other is an odd integer
2325 if y.sign == 1:
2741 # positive sign and min returns the operand with the negative sign
2845 sign = self._sign
2856 if sign:
2861 if sign:
2867 if sign:
2892 if sign:
2897 if sign:
2905 """Compares self to other using abstract repr., ignoring sign.
2907 Like compare_total, but with operand's sign ignored and assumed to be 0.
2916 """Returns a copy with the sign set to 0. """
2920 """Returns a copy with the sign inverted."""
2927 """Returns self with the sign of other."""
2983 if op.sign == 1:
3252 For being logical, it must be a finite number with a sign of 0,
3335 """Compares the values numerically with their sign ignored."""
3365 """Compares the values numerically with their sign ignored."""
3447 sign set to be the same as the sign of other.
3666 sign = _format_sign(self._sign, spec)
3668 return _format_align(sign, body, spec)
3724 def _dec_from_triple(sign, coefficient, exponent, special=False):
3733 self._sign = sign
4114 """Compares two operands using their abstract representation ignoring sign.
4116 Like compare_total, but with operand's sign ignored and assumed to be 0.
4122 """Returns a copy of the operand with the sign set to 0.
4148 """Returns a copy of the operand with the sign inverted.
4161 """Copies the second operand's sign to the first one.
4163 In detail, it returns a copy of the first operand with the sign
4164 equal to the sign of the second operand.
4690 """Compares the values numerically with their sign ignored.
4734 """Compares the values numerically with their sign ignored.
5116 to precision digits if necessary. The sign of the result, if
5152 is chosen). If the result is equal to 0 then its sign will be the
5153 sign of a.
5215 The result is never affected by either the sign or the coefficient of
5419 __slots__ = ('sign','int','exp')
5420 # sign: 0 or 1
5426 self.sign = None
5430 self.sign = value._sign
5435 self.sign = value[0]
5440 return "(%r, %r, %r)" % (self.sign, self.int, self.exp)
5896 # number between the optional sign and the optional exponent must have
5903 (?P<sign>[-+])? # an optional sign, followed by either...
5930 # [[fill]align][sign][0][minimumwidth][,][.precision][type]
5937 (?P<sign>[-+ ])?
5964 sign: either '+', '-' or ' '
6001 # default sign handling: '-' for negative, '' for positive
6002 if format_dict['sign'] is None:
6003 format_dict['sign'] = '-'
6040 def _format_align(sign, body, spec):
6041 """Given an unpadded, non-aligned numeric string 'body' and sign
6042 string 'sign', add padding and alignment conforming to the given
6052 padding = fill*(minimumwidth - len(sign) - len(body))
6056 result = sign + body + padding
6058 result = padding + sign + body
6060 result = sign + padding + body
6063 result = padding[:half] + sign + body + padding[half:]
6134 """Determine sign character."""
6138 elif spec['sign'] in ' +':
6139 return spec['sign']
6154 format the sign
6161 sign = _format_sign(is_negative, spec)
6173 min_width = spec['minimumwidth'] - len(fracpart) - len(sign)
6178 return _format_align(sign, intpart+fracpart, spec)
6191 # _SignedInfinity[sign] is infinity w/ that sign