{"id":91,"date":"2009-04-23T15:43:13","date_gmt":"2009-04-23T15:43:13","guid":{"rendered":"http:\/\/www.weeklywhinge.com\/?p=91"},"modified":"2009-04-23T16:02:32","modified_gmt":"2009-04-23T16:02:32","slug":"dude-youre-so-like-negative","status":"publish","type":"post","link":"https:\/\/www.weeklywhinge.com\/?p=91","title":{"rendered":"Dude, you&#8217;re so, like, negative (zero)"},"content":{"rendered":"<h5>Edit: this is fixed in 5.1.30, so I&#8217;m guessing it was fixed a while back &#8211; I&#8217;m working on a legacy system using 5.0.15.<\/h5>\n<p>\u00c2\u00a0<\/p>\n<p>So MySQL thinks that<\/p>\n<blockquote><p><code>SELECT -COALESCE(null, 0);<\/code><\/p><\/blockquote>\n<p>should return -0<\/p>\n<p>(Whatever -0 is)&#8230;<\/p>\n<p>Clearly I&#8217;ve simplified my code and there are ways around this, but&#8230; WTF?<\/p>\n<p>\u00c2\u00a0<\/p>\n<p>For what it&#8217;s worth,<\/p>\n<blockquote><p><code>SELECT -COALESCE(null, 0) + 0;<\/code><\/p><\/blockquote>\n<p>results in the expected &#8220;0&#8221; value.<\/p>\n<p>\u00c2\u00a0<\/p>\n<p>I was disappointed that<\/p>\n<blockquote><p><code>SELECT -COALESCE(null, -0);<\/code><\/p><\/blockquote>\n<p>doesn&#8217;t work though &#8211; if you&#8217;re going to believe that -0 is a valid number, you should be able to get +0 out of it.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Edit: this is fixed in 5.1.30, so I&#8217;m guessing it was fixed a while back &#8211; I&#8217;m working on a legacy system using 5.0.15. \u00c2\u00a0 So MySQL thinks that SELECT -COALESCE(null, 0); should return -0 (Whatever -0 is)&#8230; Clearly I&#8217;ve simplified my code and there are ways around this, but&#8230; WTF? \u00c2\u00a0 For what it&#8217;s [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,7,2],"tags":[45,47,49,15,46,48],"class_list":["post-91","post","type-post","status-publish","format-standard","hentry","category-tech","category-webdev","category-whinges","tag-zero","tag-coalesce","tag-mysql","tag-negative-zero","tag-null"],"_links":{"self":[{"href":"https:\/\/www.weeklywhinge.com\/index.php?rest_route=\/wp\/v2\/posts\/91","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.weeklywhinge.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.weeklywhinge.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.weeklywhinge.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.weeklywhinge.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=91"}],"version-history":[{"count":5,"href":"https:\/\/www.weeklywhinge.com\/index.php?rest_route=\/wp\/v2\/posts\/91\/revisions"}],"predecessor-version":[{"id":93,"href":"https:\/\/www.weeklywhinge.com\/index.php?rest_route=\/wp\/v2\/posts\/91\/revisions\/93"}],"wp:attachment":[{"href":"https:\/\/www.weeklywhinge.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=91"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.weeklywhinge.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=91"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.weeklywhinge.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=91"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}