Fix llAbs corner case.

As an exception, llAbs(-2147483648) equals -2147483648.
This commit is contained in:
Sei Lisa 2017-01-18 00:50:59 +01:00
parent 3a91f04cb5
commit 7f8cb4ec58
2 changed files with 3 additions and 2 deletions

View file

@ -821,7 +821,7 @@ def reduce(t):
def llAbs(i): def llAbs(i):
assert isinteger(i) assert isinteger(i)
return abs(i) return abs(i) if i != -2147483648 else i
def llAcos(f): def llAcos(f):
assert isfloat(f) assert isfloat(f)

View file

@ -1262,7 +1262,8 @@ def do_tests():
testB642S("FC83BFBFBFBF78", "%3Fx") # aliased range end (U+3FFFFFF) testB642S("FC83BFBFBFBF78", "%3Fx") # aliased range end (U+3FFFFFF)
testB642S("FC848080808078", "%3F%3F%3F%3F%3F%3Fx") # U+4000000 (invalid 6-byte range start) testB642S("FC848080808078", "%3F%3F%3F%3F%3F%3Fx") # U+4000000 (invalid 6-byte range start)
testB642S("FDBFBFBFBFBF78", "%3F%3F%3F%3F%3F%3Fx") # U+7FFFFFFF (invalid 6-byte range end) testB642S("FDBFBFBFBFBF78", "%3F%3F%3F%3F%3F%3Fx") # U+7FFFFFFF (invalid 6-byte range end)
# not actually valid either way (these are actually used to distinguish the input as UTF-16 BOM) # not actually valid either way (these are actually used to distinguish the
# input as UTF-16 BOM and are invalid in UTF-8)
testB642S("FEB080808080808078", "%3F%3F%3F%3F%3F%3F%3F%3Fx") testB642S("FEB080808080808078", "%3F%3F%3F%3F%3F%3F%3F%3Fx")
testB642S("FFBFBFBFBFBFBFBF78", "%3F%3F%3F%3F%3F%3F%3F%3Fx") testB642S("FFBFBFBFBFBFBFBF78", "%3F%3F%3F%3F%3F%3F%3F%3Fx")
# short or invalid sequences # short or invalid sequences