{"id":2340,"date":"2019-07-29T20:40:17","date_gmt":"2019-07-29T20:40:17","guid":{"rendered":"http:\/\/www.sydneysmith.com\/wordpress\/?p=2340"},"modified":"2019-07-29T20:59:19","modified_gmt":"2019-07-29T20:59:19","slug":"hp-25-non-normalized-numbers","status":"publish","type":"post","link":"https:\/\/www.sydneysmith.com\/wordpress\/2340\/hp-25-non-normalized-numbers\/","title":{"rendered":"HP-25 Non-Normalized Numbers"},"content":{"rendered":"<p>It turns out that once you have access to some <a href=\"http:\/\/www.sydneysmith.com\/wordpress\/2333\/hp-25-undocumented-features\/\">HP-25 functions that aren&#8217;t on the keyboard<\/a>, you can put a lot of interesting &#8220;numbers&#8221; on the stack. <!--more--><\/p>\n<p>The question I wanted to check was this: when I use prgcode &#8220;ca&#8221; to give 10 in X, does it lift the stack?<\/p>\n<p>If there is a final value on the stack (eg 4 ENTER 5 + or 1 X&lt;-&gt;Y X&lt;-&gt;Y) sure &#8211; it lifts. And if you do 3 ENTER 4 CLx, you end up with 3 in Y and, after running a &#8220;ca&#8221; program step, 10 in X.<\/p>\n<p>There&#8217;s another one to check though: key in 5 then run &#8220;ca&#8221;. What does that do?<\/p>\n<p>Here&#8217;s the before:<br \/>\n<img loading=\"lazy\" src=\"http:\/\/www.sydneysmith.com\/wordpress\/wp-content\/uploads\/2019\/07\/hp25-5.png\" alt=\"HP-25 showing 5\" width=\"326\" height=\"148\" class=\"alignnone size-full wp-image-2341\" srcset=\"https:\/\/www.sydneysmith.com\/wordpress\/wp-content\/uploads\/2019\/07\/hp25-5.png 326w, https:\/\/www.sydneysmith.com\/wordpress\/wp-content\/uploads\/2019\/07\/hp25-5-300x136.png 300w\" sizes=\"(max-width: 326px) 100vw, 326px\" \/><\/p>\n<p>Here&#8217;s the after:<br \/>\n<img loading=\"lazy\" src=\"http:\/\/www.sydneysmith.com\/wordpress\/wp-content\/uploads\/2019\/07\/hp25-5a.png\" alt=\"HP-25 with 5 and ca\" width=\"328\" height=\"148\" class=\"alignnone size-full wp-image-2342\" srcset=\"https:\/\/www.sydneysmith.com\/wordpress\/wp-content\/uploads\/2019\/07\/hp25-5a.png 328w, https:\/\/www.sydneysmith.com\/wordpress\/wp-content\/uploads\/2019\/07\/hp25-5a-300x135.png 300w\" sizes=\"(max-width: 328px) 100vw, 328px\" \/><\/p>\n<p>It doesn&#8217;t look like either: lifted or didn&#8217;t. It doesn&#8217;t seem to make any sense, until you see what is actually in the X register.<\/p>\n<p>Here&#8217;s what that looks like:<br \/>\n<img loading=\"lazy\" src=\"http:\/\/www.sydneysmith.com\/wordpress\/wp-content\/uploads\/2019\/07\/hp25-5a-internal.png\" alt=\"Internal view of HP-25 with 5a\" width=\"334\" height=\"214\" class=\"alignnone size-full wp-image-2343\" srcset=\"https:\/\/www.sydneysmith.com\/wordpress\/wp-content\/uploads\/2019\/07\/hp25-5a-internal.png 334w, https:\/\/www.sydneysmith.com\/wordpress\/wp-content\/uploads\/2019\/07\/hp25-5a-internal-300x192.png 300w\" sizes=\"(max-width: 334px) 100vw, 334px\" \/><br \/>\nYou can see &#8221; 60.00&#8243; is in the display (A=06000&#8230; B=20100&#8230;).<\/p>\n<p>But what is really interesting, is what is in C and M2 (the actual X register inside the HP-25 processor). That is &#8220;05a00000000001&#8221;. The sign is positive (first &#8220;0&#8221;). The mantissa is &#8220;5.a00000000&#8221; (next 10 digits, with a decimal point after the first one). The exponent sign is positive (next &#8220;0&#8221;), and the exponent is &#8220;01&#8221;.<\/p>\n<p>We have 5.a x 10^1 or 5a. That is being shown as 5 tens plus 10 ones. i.e. 60.<\/p>\n<p>But, but &#8211; but there&#8217;s an &#8220;a&#8221; in the digits! Yep, a non-normalized number.<\/p>\n<p>I hadn&#8217;t looked before but when I went to key in 2 f 3 a 4 as program steps, I noticed that 2 is prgcode &#8220;c2&#8221;, 3 is prgcode &#8220;c3&#8221; and 4 is prgcode &#8220;c4&#8221;. Interesting right? Our &#8220;ca&#8221; to &#8220;cf&#8221; prgcodes are a natural extension of the &#8220;0&#8221; to &#8220;9&#8221; keys; instead of things that coincidently give those 10 to 15 values.<\/p>\n<p>The 2 f 3 a 4 sequence doesn&#8217;t do what I&#8217;d hoped for. It isn&#8217;t a simple store a digit then move right one place. You get 24040.00 in the display and &#8220;023a4000000004&#8221; in C and M2. The earlier &#8220;f&#8221; got dropped.<\/p>\n<p>It isn&#8217;t &#8220;earlier hex digits&#8221; though. It only seems to be &#8220;f&#8221; digits (perhaps it&#8217;s overflow \/ carry related). The following gave me what I expected: c2 cb c3 ca c4 (2 b 3 a 4). C and M2 = 02b3a400000004, i.e. &#8220;2b3a4&#8221;. That displays as &#8220;31404.00&#8221; (20000 + 11*1000 + 300 + 10*10 + 4 = 20000 + 11000 + 300 + 100 + 4 = 31404).<\/p>\n<p>It turns out you can put non-normalized numbers in the X register of a HP-25\/C.<\/p>\n<p>STO 6 will happily store the non-normalized number as-is in memory 6. CLx RCL 6 will happily bring it back again (also with the hex digits intact).<\/p>\n<p>Some of the fancier tricks we used to do with HP-67 non-normalized numbers (such as 0.00001e+00 taking much longer to divide than 1.00000e-05; and letters in the display) are still out of reach for now. However, there is more to the HP-25 than we thought previously.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It turns out that once you have access to some HP-25 functions that aren&#8217;t on the keyboard, you can put a lot of interesting &#8220;numbers&#8221; on the stack.<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[16,5,69],"tags":[],"_links":{"self":[{"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/posts\/2340"}],"collection":[{"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/comments?post=2340"}],"version-history":[{"count":4,"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/posts\/2340\/revisions"}],"predecessor-version":[{"id":2347,"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/posts\/2340\/revisions\/2347"}],"wp:attachment":[{"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/media?parent=2340"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/categories?post=2340"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sydneysmith.com\/wordpress\/wp-json\/wp\/v2\/tags?post=2340"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}