{"id":863,"date":"2022-08-30T15:08:26","date_gmt":"2022-08-30T15:08:26","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/09\/fcom-floating-point-comparison-fails-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:08:26","modified_gmt":"2022-08-30T15:08:26","slug":"fcom-floating-point-comparison-fails-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/fcom-floating-point-comparison-fails-collection-of-common-programming-errors\/","title":{"rendered":"FCOM floating point comparison fails-Collection of common programming errors"},"content":{"rendered":"<p>Change <code>JL<\/code> to <code>JB<\/code>, since you can only do <em>unsigned<\/em> comparisons with the FPU flags.<\/p>\n<p>The reason is that 8087 has only 2 equivalent status bits at the same positions as 8086. Those are CF and ZF. When doing a signed comparison, the processor uses OF state from any preceding operation and the 8087 Busy State as the sign bit.<\/p>\n<pre><code> 8087:   [Busy] [ EQ ] [ Top of Stack Ptr ] [UND] [SOF] [ LT ]\n                  C3                         C2     C1    C0<\/code><\/pre>\n<p id=\"rop\"><small>Originally posted 2013-11-09 22:49:25. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>Change JL to JB, since you can only do unsigned comparisons with the FPU flags. The reason is that 8087 has only 2 equivalent status bits at the same positions as 8086. Those are CF and ZF. When doing a signed comparison, the processor uses OF state from any preceding operation and the 8087 Busy [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-863","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/863","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=863"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/863\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=863"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=863"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=863"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}