Thanks for the fixes! I have fixed the commit
message on the branch. Now the patch LGTM.
On 17/07/2018 15:03, Kirill Shcherbatov wrote:
Actually, the max value is not INT64_MAX; but UINT64_MAX that is tested above.+-- gh-3466: Strange behaviour of tonumber64 function2. Where is a test for another corner case? I mean INT64_MAX.
+--
+tostring(tonumber64('18446744073709551615')) == '18446744073709551615ULL'
+tonumber64('18446744073709551616') == nil
But I don't mind to add INT64_MAX test.
+tostring(tonumber64('9223372036854775807')) == '9223372036854775807ULL'
I also propose to test zero.+tostring(tonumber64('0')) == '0'
1. Please, add a comment about the things we have discussed as Alexander asked+ /*
in the previous message.
+ * To test overflow, consider
+ * result > -INT64_MIN;
+ * result - 1 > -INT64_MIN - 1;
+ * Assumption:
+ * INT64_MAX == -(INT64_MIN + 1);
+ * Finally,
+ * result - 1 > INT64_MAX;
+ */