{"id":203,"date":"2010-11-11T21:45:24","date_gmt":"2010-11-11T17:45:24","guid":{"rendered":"http:\/\/nayarweb.com\/blog\/?p=203"},"modified":"2010-11-11T21:45:24","modified_gmt":"2010-11-11T17:45:24","slug":"2147483647","status":"publish","type":"post","link":"https:\/\/nayarweb.com\/blog\/2010\/2147483647\/","title":{"rendered":"2147483647"},"content":{"rendered":"<p>You must be thinking i put a random number as title. You are wrong! It is a very special number. You will see why.<\/p>\n<p>I am working on FBConnect plugin for MyBB. It was storing Facebook UID&#8217;s in an &#8220;int(15)&#8221; field in a MySQL database. Everything seemed to work perfectly until i tested the registration process with an account whose Facebook UID is a 15 digit number. It just kept storing the number 2147483647. <\/p>\n<p>I spent the whole day revising my codes. They all seemed OK. I was really puzzled. Then i thought: Why not <a href=\"http:\/\/lmgtfy.com\/?q=2147483647\">google the number<\/a>?<\/p>\n<blockquote><p><del datetime=\"2011-01-14T12:23:58+00:00\">2<sup>32<\/sup> &#8211; 1  = 2147483647<\/del><br \/>\n2<sup>31<\/sup> &#8211; 1  = 2147483647<\/p><\/blockquote>\n<p>Whats so special about it? <del datetime=\"2011-01-14T12:23:58+00:00\">In fact, it is the biggest number that can be made using a 32-bit binary number system<\/del> I thought it was the higheest number that was possible with a 32-bit binary number system. But i was wrong. Thanks to the clarifications Rick Hemstra, i found out it is half the greatest number possible with a 32-bit binary number system. This is because this MySQL field also hold negative values. Therefore, the maximun number decreases by half.<\/p>\n<p>The solution:-<br \/>\nAll i had to do is to change the field type to &#8220;bigint(15)&#8221;. The new limit is now:<br \/>\n2<sup>63<\/sup> &#8211; 1  = 9,223,372,036,854,775,807 \ud83d\ude00<\/p>\n<p>Problem solved \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>You must be thinking i put a random number as title. You are wrong! It is a very special number. You will see why. I am working on FBConnect plugin for MyBB. It was storing Facebook UID&#8217;s in an &#8220;int(15)&#8221; field in a MySQL database. Everything seemed to work perfectly until i tested the registration &hellip; <a href=\"https:\/\/nayarweb.com\/blog\/2010\/2147483647\/\" class=\"continue-reading\">Continue reading <span class=\"screen-reader-text\">2147483647<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[75,76,117],"class_list":["post-203","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-mybb-plugin","tag-mysql","tag-web-development"],"_links":{"self":[{"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/posts\/203","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/comments?post=203"}],"version-history":[{"count":0,"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/posts\/203\/revisions"}],"wp:attachment":[{"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/media?parent=203"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/categories?post=203"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/tags?post=203"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}