Lines Matching refs:sign

162     DecimalTuple = _namedtuple('DecimalTuple', 'sign digits exponent')
247 also a quiet NaN, but with the original sign, and an optional
274 The result of the operation is [sign,inf], where sign is the exclusive
279 def handle(self, context, sign, *args):
280 return _SignedInfinity[sign]
364 round-up, if implemented), the result of the operation is [sign,inf],
365 where sign is the sign of the intermediate result. For round-down, the
367 current precision, with the sign of the intermediate result. For
368 round-ceiling, the result is the same as for round-down if the sign of
370 the result is the same as for round-down if the sign of the intermediate
375 def handle(self, context, sign, *args):
378 return _SignedInfinity[sign]
379 if sign == 0:
381 return _SignedInfinity[sign]
382 return _dec_from_triple(sign, '9'*context.prec,
384 if sign == 1:
386 return _SignedInfinity[sign]
387 return _dec_from_triple(sign, '9'*context.prec,
401 in 0 with the sign of the intermediate result and an exponent of Etiny.
537 >>> Decimal((0, (3, 1, 4), -2)) # tuple (sign, digit_tuple, exponent)
567 if m.group('sign') == "-":
616 self._sign = value.sign
628 # process sign. The isinstance test rejects floats
630 raise ValueError("Invalid sign. The first value in the tuple "
705 sign = 0 if f >= 0 else 1
712 sign = 0
714 sign = 1
721 result = _dec_from_triple(sign, coeff, -k)
1010 # we'll deal with the sign later.
1047 sign = ['', '-'][self._sign]
1050 return sign + 'Infinity'
1052 return sign + 'NaN' + self._int
1054 return sign + 'sNaN' + self._int
1091 return sign + intpart + fracpart + exp
1103 """Returns a copy with the sign switched.
1185 # If both INF, same sign => same as both, opposite => error.
1195 # If the answer is 0, the sign should be negative, in this case.
1199 sign = min(self._sign, other._sign)
1201 sign = 1
1202 ans = _dec_from_triple(sign, '0', exp)
1221 if op1.sign != op2.sign:
1230 if op1.sign == 1:
1231 result.sign = 1
1232 op1.sign, op2.sign = op2.sign, op1.sign
1234 result.sign = 0
1235 # So we know the sign, and op1 > 0.
1236 elif op1.sign == 1:
1237 result.sign = 1
1238 op1.sign, op2.sign = (0, 0)
1240 result.sign = 0
1243 if op2.sign == 0:
1343 sign = self._sign ^ other._sign
1354 return _SignedInfinity[sign]
1358 return _dec_from_triple(sign, '0', context.Etiny())
1364 return context._raise_error(DivisionByZero, 'x / 0', sign)
1390 ans = _dec_from_triple(sign, str(coeff), exp)
1399 sign = self._sign ^ other._sign
1407 return (_dec_from_triple(sign, '0', 0),
1418 return (_dec_from_triple(sign, str(q), 0),
1448 sign = self._sign ^ other._sign
1454 return (_SignedInfinity[sign],
1462 return (context._raise_error(DivisionByZero, 'x // 0', sign),
1576 # result has same sign as self unless r is negative
1577 sign = self._sign
1579 sign = 1-sign
1582 ans = _dec_from_triple(sign, str(r), ideal_exponent)
2041 # compute sign of result
2043 sign = 0
2045 sign = self._sign
2059 return _dec_from_triple(sign, str(base), 0)
2142 if y.sign == 1:
2154 if y.sign == 1:
2344 # result has sign 1 iff self._sign is 1 and other is an odd integer
2449 if y.sign == 1:
2855 # positive sign and min returns the operand with the negative sign
2959 sign = self._sign
2970 if sign:
2975 if sign:
2981 if sign:
3006 if sign:
3011 if sign:
3019 """Compares self to other using abstract repr., ignoring sign.
3021 Like compare_total, but with operand's sign ignored and assumed to be 0.
3030 """Returns a copy with the sign set to 0. """
3034 """Returns a copy with the sign inverted."""
3041 """Returns self with the sign of other."""
3097 if op.sign == 1:
3366 For being logical, it must be a finite number with a sign of 0,
3449 """Compares the values numerically with their sign ignored."""
3479 """Compares the values numerically with their sign ignored."""
3561 sign set to be the same as the sign of other.
3780 sign = _format_sign(self._sign, spec)
3784 return _format_align(sign, body, spec)
3844 def _dec_from_triple(sign, coefficient, exponent, special=False):
3853 self._sign = sign
4302 """Compares two operands using their abstract representation ignoring sign.
4304 Like compare_total, but with operand's sign ignored and assumed to be 0.
4310 """Returns a copy of the operand with the sign set to 0.
4336 """Returns a copy of the operand with the sign inverted.
4349 """Copies the second operand's sign to the first one.
4351 In detail, it returns a copy of the first operand with the sign
4352 equal to the sign of the second operand.
4880 """Compares the values numerically with their sign ignored.
4924 """Compares the values numerically with their sign ignored.
5306 to precision digits if necessary. The sign of the result, if
5342 is chosen). If the result is equal to 0 then its sign will be the
5343 sign of a.
5405 The result is never affected by either the sign or the coefficient of
5629 __slots__ = ('sign','int','exp')
5630 # sign: 0 or 1
5636 self.sign = None
5640 self.sign = value._sign
5645 self.sign = value[0]
5650 return "(%r, %r, %r)" % (self.sign, self.int, self.exp)
6126 # number between the optional sign and the optional exponent must have
6133 (?P<sign>[-+])? # an optional sign, followed by either...
6160 # [[fill]align][sign][z][#][0][minimumwidth][,][.precision][type]
6167 (?P<sign>[-+ ])?
6196 sign: either '+', '-' or ' '
6232 # default sign handling: '-' for negative, '' for positive
6233 if format_dict['sign'] is None:
6234 format_dict['sign'] = '-'
6268 def _format_align(sign, body, spec):
6269 """Given an unpadded, non-aligned numeric string 'body' and sign
6270 string 'sign', add padding and alignment conforming to the given
6278 padding = fill*(minimumwidth - len(sign) - len(body))
6282 result = sign + body + padding
6284 result = padding + sign + body
6286 result = sign + padding + body
6289 result = padding[:half] + sign + body + padding[half:]
6356 """Determine sign character."""
6360 elif spec['sign'] in ' +':
6361 return spec['sign']
6376 format the sign
6383 sign = _format_sign(is_negative, spec)
6395 min_width = spec['minimumwidth'] - len(fracpart) - len(sign)
6400 return _format_align(sign, intpart+fracpart, spec)
6413 # _SignedInfinity[sign] is infinity w/ that sign