{"id":38099,"date":"2019-09-11T21:37:03","date_gmt":"2019-09-11T21:37:03","guid":{"rendered":"https:\/\/www.oracletutoring.ca\/blog\/?p=38099"},"modified":"2019-09-11T21:41:11","modified_gmt":"2019-09-11T21:41:11","slug":"calculator-use-when-adding-isnt-associative","status":"publish","type":"post","link":"https:\/\/www.oracletutoring.ca\/blog\/calculator-use-when-adding-isnt-associative\/","title":{"rendered":"Calculator use: when adding isn&#8217;t associative(?)"},"content":{"rendered":"\n<h2>Tutoring math, curiosities can arise. The tutor mentions a calculator one.<\/h2>\n<p>\nIn front of me are two reliable scientific calculators from different manufacturers. Both give the following results:\n<\/p><p>\n2+1exp20-1exp20 = 0<\/p><p>\nbut<\/p><p>\n2+(1exp20-1exp20)=2\n<\/p><p>\n1exp20 means scientific notation: 1&#215;10<sup>20<\/sup>.\n<\/p><p>\nHow can the two statements above lead to different answers?\n<\/p><p>\nTheoretically both equal 2, but the first one gives 0 for a practical reason. 1exp20 means 1 with 20 zeros behind it, or\n100 000 000 000 000 000 000.  2 is so tiny in comparison that<br>\n2 + 1exp20 \u2248 1exp20. From that premise,<br>\n2+1exp20-1exp20=1exp20-1exp20=0.\n<\/p><p>\nWith 2+(1exp20-1exp20), however, 1exp20-1exp20 is evaluated first, to exactly 0. 2+0 results, giving 2.\n<\/p><p>\nSource:<\/p><p>\nBryant, Randal E. and David R. O&#8217;Hallaron. <em>Computer Systems: A Programmer&#8217;s Perspective<\/em>, 3rd ed. Boston: Pearson, 2016.\n<\/p>\n<p><a href=\"https:\/\/dev.w3.org\/html5\/html-author\/charref\">dev.w3.org<\/a><\/p>\nJack of <a href=\"https:\/\/www.oracletutoring.ca\">Oracle Tutoring by Jack and Diane,<\/a> Campbell River, BC.\n","protected":false},"excerpt":{"rendered":"<p>Tutoring math, curiosities can arise. The tutor mentions a calculator one. In front of me are two reliable scientific calculators from different manufacturers. Both give the following results: 2+1exp20-1exp20 = 0 but 2+(1exp20-1exp20)=2 1exp20 means scientific notation: 1&#215;1020. How can &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"more-link\" href=\"https:\/\/www.oracletutoring.ca\/blog\/calculator-use-when-adding-isnt-associative\/\"> <span class=\"screen-reader-text\">Calculator use: when adding isn&#8217;t associative(?)<\/span> Read More &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-38099","post","type-post","status-publish","format-standard","hentry","category-math"],"_links":{"self":[{"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts\/38099","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/comments?post=38099"}],"version-history":[{"count":7,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts\/38099\/revisions"}],"predecessor-version":[{"id":38106,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts\/38099\/revisions\/38106"}],"wp:attachment":[{"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/media?parent=38099"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/categories?post=38099"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/tags?post=38099"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}