{"id":193,"date":"2008-12-28T18:57:57","date_gmt":"2008-12-28T23:57:57","guid":{"rendered":"http:\/\/vgable.com\/blog\/2008\/12\/28\/bug-encodelong-double\/"},"modified":"2010-08-16T05:35:31","modified_gmt":"2010-08-16T10:35:31","slug":"bug-encodelong-double","status":"publish","type":"post","link":"https:\/\/vgable.com\/blog\/2008\/12\/28\/bug-encodelong-double\/","title":{"rendered":"Bug: @encode(long double)"},"content":{"rendered":"<p>UPDATE 2010-08-16: I ran a test today, on Mac OS X 10.6.4 (i386), and <strong>the issue has been resolved, <code>@encode(long double)<\/code> evaluates to <code>\"D\"<\/code>.<\/strong> I&#8217;m not sure when this change happened, or what platforms it effects.<\/p>\n<p><code>@encode(long double)<\/code> returns the same string, <code>\"d\"<\/code>, as <code>@encode(double)<\/code>, at least on i386, Mac OS X 10.5.6 \/ 9G55.  But a <code>long double<\/code> and a <code>double<\/code> are <em>not<\/em> identical:<\/p>\n<p><code><br \/>\ndouble aDouble = M_PI;<br \/>\nlong double aLongDouble = M_PI;<br \/>\nNSLog(@\"sizeof(aDouble) = %d, sizeof(aLongDouble) = %d\",<br \/>\n<br \/>&nbsp;&nbsp;&nbsp;sizeof(aDouble), sizeof(aLongDouble));<br \/>\nNSLog(@\"aDouble = %f\", aDouble);<br \/>\nNSLog(@\"aLongDouble printed as a double (%%f) = %f\", aLongDouble);<br \/>\nNSLog(@\"aLongDouble printed as a long double (%%Lf) = %Lf\", aLongDouble);<br \/>\n<\/code><\/p>\n<blockquote><p>\nsizeof(aDouble) = 8, sizeof(aLongDouble) = 16<br \/>\naDouble = 3.141593<br \/>\naLongDouble printed as a double (%f) =<br \/>\n&nbsp;&nbsp;&nbsp;-88796093704928900002674917893032219152220160.000000<br \/>\naLongDouble printed as a long double (%Lf) = 3.141593<\/p><\/blockquote>\n<p>I haven&#8217;t tested another configuration. <code>TYPE_LONGDOUBLE_IS_DOUBLE<\/code> in ConditionalMacros.h is 1 under <code>__ppc__<\/code>, so this might not be a problem on PowerPC.<\/p>\n<p>Submitted as <a href=\"http:\/\/openradar.appspot.com\/radar?id=2016\">radar:\/\/6468314<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>UPDATE 2010-08-16: I ran a test today, on Mac OS X 10.6.4 (i386), and the issue has been resolved, @encode(long double) evaluates to &#8220;D&#8221;. I&#8217;m not sure when this change happened, or what platforms it effects. @encode(long double) returns the same string, &#8220;d&#8221;, as @encode(double), at least on i386, Mac OS X 10.5.6 \/ 9G55. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18,3,5,4],"tags":[92,271,273,272,22],"class_list":["post-193","post","type-post","status-publish","format-standard","hentry","category-bug-bite","category-macosx","category-objective-c","category-programming","tag-bugs","tag-floating-point","tag-i386","tag-long-double","tag-powerpc"],"_links":{"self":[{"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/posts\/193","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/comments?post=193"}],"version-history":[{"count":2,"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/posts\/193\/revisions"}],"predecessor-version":[{"id":669,"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/posts\/193\/revisions\/669"}],"wp:attachment":[{"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/media?parent=193"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/categories?post=193"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/tags?post=193"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}