fix some i64 printing rounding errors
This commit is contained in:
Родитель
bacb70a2ec
Коммит
e3c6c8170a
|
@ -3449,7 +3449,7 @@ LibraryManager.library = {
|
|||
},
|
||||
strtoll__deps: ['_parseInt'],
|
||||
strtoll: function(str, endptr, base) {
|
||||
return __parseInt(str, endptr, base, -9223372036854775808, 9223372036854775807, 64); // LLONG_MIN, LLONG_MAX; imprecise.
|
||||
return __parseInt(str, endptr, base, -9223372036854775200, 9223372036854775200, 64); // LLONG_MIN, LLONG_MAX; imprecise.
|
||||
},
|
||||
strtol__deps: ['_parseInt'],
|
||||
strtol: function(str, endptr, base) {
|
||||
|
|
|
@ -79,9 +79,9 @@ var RuntimeGenerator = {
|
|||
// Rounding is inevitable if the number is large. This is a particular problem for small negative numbers
|
||||
// (-1 will be rounded!), so handle negatives separately and carefully
|
||||
makeBigInt: function(low, high, unsigned) {
|
||||
return '((' + unsigned + ' || (' + makeSignOp(high, 'i32', 're', 1, 1) + ' >= 0))' +
|
||||
return '(' + unsigned +
|
||||
' ? (' + makeSignOp(low, 'i32', 'un', 1, 1) + '+(' + makeSignOp(high, 'i32', 'un', 1, 1) + '*4294967296))' +
|
||||
' : (' + makeSignOp(low, 'i32', 're', 1, 1) + '+(1+' + makeSignOp(high, 'i32', 're', 1, 1) + ')*4294967296))';
|
||||
' : (' + makeSignOp(low, 'i32', 'un', 1, 1) + '+(' + makeSignOp(high, 'i32', 're', 1, 1) + '*4294967296)))';
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
strtol("-9223372036854775809") = -2147483648
|
||||
ERR 34
|
||||
strtoll("-9223372036854775809") = 9223372036854776000
|
||||
strtoll("-9223372036854775809") = -9223372036854775000
|
||||
ERR 34
|
||||
strtoul("-9223372036854775809") = 4294967295
|
||||
ERR 34
|
||||
|
@ -8,7 +8,7 @@ strtoull("-9223372036854775809") = 9223372036854774000
|
|||
|
||||
strtol("-9223372036854775808") = -2147483648
|
||||
ERR 34
|
||||
strtoll("-9223372036854775808") = 9223372036854776000
|
||||
strtoll("-9223372036854775808") = -9223372036854775000
|
||||
ERR 34
|
||||
strtoul("-9223372036854775808") = 4294967295
|
||||
ERR 34
|
||||
|
@ -16,7 +16,7 @@ strtoull("-9223372036854775808") = 9223372036854774000
|
|||
|
||||
strtol("-9223372036854775807") = -2147483648
|
||||
ERR 34
|
||||
strtoll("-9223372036854775807") = 9223372036854776000
|
||||
strtoll("-9223372036854775807") = -9223372036854775000
|
||||
ERR 34
|
||||
strtoul("-9223372036854775807") = 4294967295
|
||||
ERR 34
|
||||
|
@ -24,7 +24,7 @@ strtoull("-9223372036854775807") = 9223372036854774000
|
|||
|
||||
strtol("-2147483649") = -2147483648
|
||||
ERR 34
|
||||
strtoll("-2147483649") = -2147483648
|
||||
strtoll("-2147483649") = -2147483649
|
||||
strtoul("-2147483649") = 2147483647
|
||||
strtoull("-2147483649") = 18446744071562068000
|
||||
|
||||
|
@ -34,17 +34,17 @@ strtoul("-2147483648") = 2147483648
|
|||
strtoull("-2147483648") = 18446744071562068000
|
||||
|
||||
strtol("-2147483647") = -2147483647
|
||||
strtoll("-2147483647") = -2147483648
|
||||
strtoll("-2147483647") = -2147483647
|
||||
strtoul("-2147483647") = 2147483649
|
||||
strtoull("-2147483647") = 18446744071562068000
|
||||
|
||||
strtol("-5") = -5
|
||||
strtoll("-5") = 0
|
||||
strtoll("-5") = -5
|
||||
strtoul("-5") = 4294967291
|
||||
strtoull("-5") = 18446744069414584000
|
||||
|
||||
strtol("-1") = -1
|
||||
strtoll("-1") = 0
|
||||
strtoll("-1") = -1
|
||||
strtoul("-1") = 4294967295
|
||||
strtoull("-1") = 18446744069414584000
|
||||
|
||||
|
@ -100,7 +100,7 @@ strtoull("4294967296") = 4294967296
|
|||
|
||||
strtol("18446744073709551614") = 2147483647
|
||||
ERR 34
|
||||
strtoll("18446744073709551614") = 9223372036854776000
|
||||
strtoll("18446744073709551614") = 9223372036854775000
|
||||
ERR 34
|
||||
strtoul("18446744073709551614") = 4294967295
|
||||
ERR 34
|
||||
|
@ -108,7 +108,7 @@ strtoull("18446744073709551614") = 18446744069414584000
|
|||
|
||||
strtol("18446744073709551615") = 2147483647
|
||||
ERR 34
|
||||
strtoll("18446744073709551615") = 9223372036854776000
|
||||
strtoll("18446744073709551615") = 9223372036854775000
|
||||
ERR 34
|
||||
strtoul("18446744073709551615") = 4294967295
|
||||
ERR 34
|
||||
|
@ -116,7 +116,7 @@ strtoull("18446744073709551615") = 18446744069414584000
|
|||
|
||||
strtol("18446744073709551616") = 2147483647
|
||||
ERR 34
|
||||
strtoll("18446744073709551616") = 9223372036854776000
|
||||
strtoll("18446744073709551616") = 9223372036854775000
|
||||
ERR 34
|
||||
strtoul("18446744073709551616") = 4294967295
|
||||
ERR 34
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
strtol("-9223372036854775809") = -2147483648
|
||||
ERR 34
|
||||
strtoll("-9223372036854775809") = 9223372036854776000
|
||||
strtoll("-9223372036854775809") = -9223372036854775000
|
||||
ERR 34
|
||||
strtoul("-9223372036854775809") = 4294967295
|
||||
ERR 34
|
||||
|
@ -8,7 +8,7 @@ strtoull("-9223372036854775809") = 9223372036854774000
|
|||
|
||||
strtol("-9223372036854775808") = -2147483648
|
||||
ERR 34
|
||||
strtoll("-9223372036854775808") = 9223372036854776000
|
||||
strtoll("-9223372036854775808") = -9223372036854775000
|
||||
ERR 34
|
||||
strtoul("-9223372036854775808") = 4294967295
|
||||
ERR 34
|
||||
|
@ -16,7 +16,7 @@ strtoull("-9223372036854775808") = 9223372036854774000
|
|||
|
||||
strtol("-9223372036854775807") = -2147483648
|
||||
ERR 34
|
||||
strtoll("-9223372036854775807") = 9223372036854776000
|
||||
strtoll("-9223372036854775807") = -9223372036854775000
|
||||
ERR 34
|
||||
strtoul("-9223372036854775807") = 4294967295
|
||||
ERR 34
|
||||
|
@ -24,7 +24,7 @@ strtoull("-9223372036854775807") = 9223372036854774000
|
|||
|
||||
strtol("-2147483649") = -2147483648
|
||||
ERR 34
|
||||
strtoll("-2147483649") = -2147483648
|
||||
strtoll("-2147483649") = -2147483649
|
||||
strtoul("-2147483649") = 2147483647
|
||||
strtoull("-2147483649") = 18446744071562068000
|
||||
|
||||
|
@ -34,19 +34,19 @@ strtoul("-2147483648") = 2147483648
|
|||
strtoull("-2147483648") = 18446744071562068000
|
||||
|
||||
strtol("-2147483647") = -2147483647
|
||||
strtoll("-2147483647") = -2147483648
|
||||
strtoll("-2147483647") = -2147483647
|
||||
strtoul("-2147483647") = 2147483649
|
||||
strtoull("-2147483647") = 18446744071562068000
|
||||
|
||||
strtol("-5") = -5
|
||||
strtoll("-5") = 0
|
||||
strtoll("-5") = -5
|
||||
strtoul("-5") = 4294967291
|
||||
strtoull("-5") = 18446744073709552000
|
||||
strtoull("-5") = 18446744069414584000
|
||||
|
||||
strtol("-1") = -1
|
||||
strtoll("-1") = 0
|
||||
strtoll("-1") = -1
|
||||
strtoul("-1") = 4294967295
|
||||
strtoull("-1") = 18446744073709552000
|
||||
strtoull("-1") = 18446744069414584000
|
||||
|
||||
strtol("0") = 0
|
||||
strtoll("0") = 0
|
||||
|
@ -100,27 +100,27 @@ strtoull("4294967296") = 4294967296
|
|||
|
||||
strtol("18446744073709551614") = 2147483647
|
||||
ERR 34
|
||||
strtoll("18446744073709551614") = 9223372036854776000
|
||||
strtoll("18446744073709551614") = 9223372036854775000
|
||||
ERR 34
|
||||
strtoul("18446744073709551614") = 4294967295
|
||||
ERR 34
|
||||
strtoull("18446744073709551614") = 18446744073709552000
|
||||
strtoull("18446744073709551614") = 18446744069414584000
|
||||
|
||||
strtol("18446744073709551615") = 2147483647
|
||||
ERR 34
|
||||
strtoll("18446744073709551615") = 9223372036854776000
|
||||
strtoll("18446744073709551615") = 9223372036854775000
|
||||
ERR 34
|
||||
strtoul("18446744073709551615") = 4294967295
|
||||
ERR 34
|
||||
strtoull("18446744073709551615") = 18446744073709552000
|
||||
strtoull("18446744073709551615") = 18446744069414584000
|
||||
|
||||
strtol("18446744073709551616") = 2147483647
|
||||
ERR 34
|
||||
strtoll("18446744073709551616") = 9223372036854776000
|
||||
strtoll("18446744073709551616") = 9223372036854775000
|
||||
ERR 34
|
||||
strtoul("18446744073709551616") = 4294967295
|
||||
ERR 34
|
||||
strtoull("18446744073709551616") = 18446744073709552000
|
||||
strtoull("18446744073709551616") = 18446744069414584000
|
||||
|
||||
strtol("0x12", 0, 0) = 18
|
||||
strtol("0x12", 0, 10) = 0
|
||||
|
|
Загрузка…
Ссылка в новой задаче