{"id":54,"date":"2021-06-06T17:45:27","date_gmt":"2021-06-06T15:45:27","guid":{"rendered":"http:\/\/automatico.freevar.com\/?page_id=54"},"modified":"2021-09-28T11:57:35","modified_gmt":"2021-09-28T09:57:35","slug":"hitech-c-per-z80","status":"publish","type":"page","link":"https:\/\/automatico.freevar.com\/index.php\/cp-m-80-2\/hitech-c-per-z80\/","title":{"rendered":"HITECH C 3.09 Z80"},"content":{"rendered":"\r\n<p><span style=\"font-size: 14pt;\">The original HITECH C linker (LINK.COM) has been renamed as LINQ.COM and the C.COM compiler has been modified to invoke this linker.\u00a0This was done to avoid a name conflict with the CP \/ M linker provided by Digital Research.\u00a0As provided in v3.09, the LIBF.\u00a0LIB produces inaccurate floating-point trigonometry results, as reported by &#8220;Ed&#8221; in his post to the USENET newsgroup comp.os.cpm.<\/span><\/p>\r\n<p><span style=\"font-size: 14pt;\">The Hi-tech compiler uses a 32-bit representation of float numbers.\u00a0The first bit is the sign of the number the following 7 bits represent the exponent with an offset of 64, the remaining 24 bits represent the mantissa in normalized form.<\/span><\/p>\r\n<p><span style=\"font-size: 14pt;\">The Hi-tech C compiler uses the same amount of bits for both float and double so the machine epsilon is the same in both cases.\u00a0If you do a search you will find that according to IEEE 754 &#8211; 2008 in the case of 32-bit binary representation (single precision) the machine epsilon is equal to approximately 1.19e-07.<\/span><\/p>\r\n<p><span style=\"font-size: 14pt;\">But since we are curious let&#8217;s see how it is calculated.<\/span><\/p>\r\n\r\n<pre><pre class=\"brush: cpp; title: epsilon.c; notranslate\" title=\"epsilon.c\">\r\n\r\n#include &lt;float.h&gt;\r\n#include &lt;math.h&gt;\r\n\r\nvoid main(void)\r\n{\r\n      float eps;\r\n      int cifre = 0;\r\n      eps = 1;\r\n\r\n      while ((1+eps)&amp;amp;amp;amp;amp;amp;gt;1)\r\n      {\r\n           eps = eps*0.5;\r\n           cifre++;\r\n      }\r\n      eps = eps*2;\r\n\r\n      printf (&quot;Calcolo epsilon macchina\\n&quot;);\r\n      printf (&quot;Cifre mantissa: %d\\n&quot;,cifre);\r\n      printf (&quot;Epsilon: %.16e&quot;,eps);\r\n}\r\n\r\n<\/pre><\/pre>\r\n\r\n<p><span style=\"font-size: 14pt;\">We call for the compilation<\/span><\/p>\r\n<p><span style=\"font-size: 14pt;\">\r\n\r\n<\/span><\/p>\r\n<p><span style=\"font-size: 14pt;\">C&gt;c -v epsilon.c -lf<\/span><\/p>\r\n<p><span style=\"font-size: 14pt;\">C&gt;epsilon<\/span><\/p>\r\n<p><span style=\"font-size: 14pt;\">\r\n\r\n\r\n\r\n<\/span><\/p>\r\n<p><span style=\"font-size: 14pt;\">The result will be:<\/span><\/p>\r\n<p><span style=\"font-size: 14pt;\">Epsilon computation\u00a0machine<\/span><br \/><span style=\"font-size: 14pt;\">Mantissa<\/span><br \/><span style=\"font-size: 14pt;\">digits\u00a0: 24\u00a0Epsilon: 1.1920927000000000e-07<\/span><\/p>\r\n<p><span style=\"font-size: 14pt;\">There is evidently a difference between the smallest representable number and the machine epsilon.\u00a0The machine epsilon represents the achievable precision that is the distance (which is not constant) in the representation of the float values, explained very roughly.\u00a0What is the use of knowing the machine epsilon?\u00a0It is essential to keep error propagation under control while running algorithms.<\/span><\/p>\r\n\r\n\r\n\r\n<p>&nbsp;<\/p>\r\n<div class=\"pvc_clear\"><\/div><p id=\"pvc_stats_54\" class=\"pvc_stats all  \" data-element-id=\"54\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/automatico.freevar.com\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p><div class=\"pvc_clear\"><\/div>","protected":false},"excerpt":{"rendered":"<p>The original HITECH C linker (LINK.COM) has been renamed as LINQ.COM and the C.COM compiler has been modified to invoke this linker.\u00a0This was done to avoid a name conflict with the CP \/ M linker provided by Digital Research.\u00a0As provided in v3.09, the LIBF.\u00a0LIB produces inaccurate floating-point trigonometry results, as reported by &#8220;Ed&#8221; in his [&hellip;]<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_54\" class=\"pvc_stats all  \" data-element-id=\"54\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/automatico.freevar.com\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"author":1,"featured_media":0,"parent":70,"menu_order":1,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-54","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/automatico.freevar.com\/index.php\/wp-json\/wp\/v2\/pages\/54"}],"collection":[{"href":"https:\/\/automatico.freevar.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/automatico.freevar.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/automatico.freevar.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/automatico.freevar.com\/index.php\/wp-json\/wp\/v2\/comments?post=54"}],"version-history":[{"count":24,"href":"https:\/\/automatico.freevar.com\/index.php\/wp-json\/wp\/v2\/pages\/54\/revisions"}],"predecessor-version":[{"id":756,"href":"https:\/\/automatico.freevar.com\/index.php\/wp-json\/wp\/v2\/pages\/54\/revisions\/756"}],"up":[{"embeddable":true,"href":"https:\/\/automatico.freevar.com\/index.php\/wp-json\/wp\/v2\/pages\/70"}],"wp:attachment":[{"href":"https:\/\/automatico.freevar.com\/index.php\/wp-json\/wp\/v2\/media?parent=54"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}