Enter RPN

Hex Artifact Content
Login

Hex Artifact Content

Artifact f4543f9c0b1166dde78f8b2bf9a8228a931e89119e45dda916a3af7706012695:

Wiki page [Percent of Total] by tangent 2025-09-20 06:30:48.
0000: 44 20 32 30 32 35 2d 30 39 2d 32 30 54 30 36 3a  D 2025-09-20T06:
0010: 33 30 3a 34 38 2e 37 31 35 0a 4c 20 50 65 72 63  30:48.715.L Perc
0020: 65 6e 74 5c 73 6f 66 5c 73 54 6f 74 61 6c 0a 4e  ent\sof\sTotal.N
0030: 20 74 65 78 74 2f 78 2d 6d 61 72 6b 64 6f 77 6e   text/x-markdown
0040: 0a 55 20 74 61 6e 67 65 6e 74 0a 57 20 32 39 31  .U tangent.W 291
0050: 34 0a 49 20 61 6d 20 6e 6f 74 20 61 20 67 72 65  4.I am not a gre
0060: 61 74 20 66 61 6e 20 6f 66 20 74 68 65 20 48 50  at fan of the HP
0070: 2d 31 32 43 2c 20 73 69 6e 63 65 20 6d 79 20 69  -12C, since my i
0080: 6e 74 65 72 65 73 74 20 69 73 20 6d 6f 72 65 20  nterest is more 
0090: 69 6e 20 74 68 65 20 73 63 69 65 6e 74 69 66 69  in the scientifi
00a0: 63 20 73 69 64 65 20 6f 66 20 74 68 65 20 63 61  c side of the ca
00b0: 6c 63 75 6c 61 74 6f 72 20 77 6f 72 6c 64 2c 20  lculator world, 
00c0: 62 75 74 20 6f 6e 65 20 66 65 61 74 75 72 65 20  but one feature 
00d0: 49 20 64 6f 20 61 64 6d 69 72 65 20 69 73 20 69  I do admire is i
00e0: 74 73 20 60 25 54 60 20 62 75 74 74 6f 6e 2e 20  ts `%T` button. 
00f0: 47 69 76 65 6e 20 61 20 74 6f 74 61 6c 20 70 75  Given a total pu
0100: 73 68 65 64 20 6f 6e 74 6f 20 74 68 65 20 73 74  shed onto the st
0110: 61 63 6b 20 61 73 20 5f 79 5f 20 61 6e 64 20 74  ack as _y_ and t
0120: 68 65 6e 20 61 20 e2 80 9c 70 61 72 74 e2 80 9d  hen a “part”
0130: 20 61 73 20 5f 78 5f 2c 20 67 69 76 65 20 74 68   as _x_, give th
0140: 65 20 70 65 72 63 65 6e 74 61 67 65 20 74 68 61  e percentage tha
0150: 74 20 5f 78 5f 20 69 73 20 6f 66 20 5f 79 5f 2e  t _x_ is of _y_.
0160: 20 46 6f 72 20 69 6e 73 74 61 6e 63 65 2c 20 74   For instance, t
0170: 68 69 72 74 79 20 69 73 20 36 30 25 20 6f 66 20  hirty is 60% of 
0180: 66 69 66 74 79 3a 0d 0a 0d 0a 60 60 60 0d 0a 35  fifty:....```..5
0190: 30 0d 0a 45 4e 54 45 52 0d 0a 33 30 0d 0a 25 54  0..ENTER..30..%T
01a0: 0d 0a 36 30 0d 0a 60 60 60 0d 0a 0d 0a 57 68 61  ..60..```....Wha
01b0: 74 20 49 20 64 6f 6e 27 74 20 67 65 74 20 69 73  t I don't get is
01c0: 20 68 6f 77 20 74 68 69 73 20 69 73 20 61 20 e2   how this is a 
01d0: 80 9c 66 69 6e 61 6e 63 69 61 6c e2 80 9d 20 63  financial” c
01e0: 61 6c 63 75 6c 61 74 69 6f 6e 2c 20 73 70 65 63  alculation, spec
01f0: 69 66 69 63 61 6c 6c 79 2e 20 49 74 e2 80 99 73  ifically. It’s
0200: 20 75 73 65 66 75 6c 20 69 6e 20 6c 6f 74 73 20   useful in lots 
0210: 6f 66 20 61 72 65 61 73 2c 20 62 75 74 20 61 73  of areas, but as
0220: 20 66 61 72 20 61 73 20 49 20 68 61 76 65 20 62   far as I have b
0230: 65 65 6e 20 61 62 6c 65 20 74 6f 20 66 69 6e 64  een able to find
0240: 20 6f 75 74 2c 20 48 50 20 6e 65 76 65 72 20 67   out, HP never g
0250: 61 76 65 20 69 74 20 74 6f 20 75 73 20 6f 6e 20  ave it to us on 
0260: 61 20 e2 80 9c 73 63 69 65 6e 74 69 66 69 63 e2  a “scientific
0270: 80 9d 20 63 61 6c 63 75 6c 61 74 6f 72 2e 20 49   calculator. I
0280: 74 20 6d 61 79 20 62 65 20 62 75 72 69 65 64 20  t may be buried 
0290: 73 6f 6d 65 77 68 65 72 65 20 69 6e 20 74 68 65  somewhere in the
02a0: 20 62 69 67 20 67 72 61 70 68 69 6e 67 20 63 61   big graphing ca
02b0: 6c 63 75 6c 61 74 6f 72 73 e2 80 99 20 6d 65 6e  lculators’ men
02c0: 75 73 2c 20 62 75 74 20 49 20 64 69 64 6e e2 80  us, but I didn
02d0: 99 74 20 67 6f 20 6c 6f 6f 6b 69 6e 67 20 74 68  t go looking th
02e0: 65 72 65 2e 0d 0a 0d 0a 41 63 63 6f 72 64 69 6e  ere.....Accordin
02f0: 67 20 74 6f 20 74 68 65 20 48 50 2d 31 32 63 20  g to the HP-12c 
0300: 50 6c 61 74 69 6e 75 6d 20 6d 61 6e 75 61 6c 2c  Platinum manual,
0310: 20 41 70 70 65 6e 64 69 78 20 45 2c 20 74 68 65   Appendix E, the
0320: 20 63 61 6c 63 75 6c 61 74 69 6f 6e 20 69 73 20   calculation is 
0330: 73 69 6d 70 6c 65 3a 0d 0a 0d 0a 60 60 60 0d 0a  simple:....```..
0340: 35 30 0d 0a 45 4e 54 45 52 0d 0a 33 30 0d 0a c3  50..ENTER..30..
0350: b7 0d 0a 31 2f f0 9d 91 a5 0d 0a 31 30 30 0d 0a  ..1/𝑥..100..
0360: c3 97 0d 0a 60 60 60 0d 0a 0d 0a 49 20 74 68 65  ×..```....I the
0370: 6e 20 61 73 6b 65 64 20 61 20 63 6f 64 69 6e 67  n asked a coding
0380: 20 41 49 3a 0d 0a 0d 0a 3e 20 57 72 69 74 65 20   AI:....> Write 
0390: 61 6e 20 48 50 2d 33 32 53 20 70 72 6f 67 72 61  an HP-32S progra
03a0: 6d 20 6c 61 62 65 6c 65 64 20 22 54 22 20 66 6f  m labeled "T" fo
03b0: 72 20 63 6f 6d 70 75 74 69 6e 67 20 74 68 65 20  r computing the 
03c0: 70 65 72 63 65 6e 74 61 67 65 20 6f 66 20 74 6f  percentage of to
03d0: 74 61 6c 20 67 69 76 65 6e 20 74 68 65 20 74 6f  tal given the to
03e0: 74 61 6c 20 69 6e 20 73 74 61 63 6b 20 72 65 67  tal in stack reg
03f0: 69 73 74 65 72 20 79 20 61 6e 64 20 74 68 65 20  ister y and the 
0400: 70 61 72 74 69 61 6c 20 76 61 6c 75 65 20 69 6e  partial value in
0410: 20 78 2e 0d 0a 0d 0a 49 74 20 74 68 6f 75 67 68   x.....It though
0420: 74 20 74 68 69 73 20 77 61 73 20 61 20 66 69 6e  t this was a fin
0430: 65 20 73 6f 6c 75 74 69 6f 6e 3a 0d 0a 0d 0a 60  e solution:....`
0440: 60 60 0d 0a 4c 42 4c 20 54 20 20 20 20 20 20 3b  ``..LBL T      ;
0450: 20 30 31 3a 20 4c 61 62 65 6c 20 54 0d 0a 52 e2   01: Label T..R
0460: 86 93 20 20 20 20 20 20 20 20 20 3b 20 30 32 3a           ; 02:
0470: 20 52 6f 6c 6c 20 64 6f 77 6e 20 28 74 6f 74 61   Roll down (tota
0480: 6c 20 67 6f 65 73 20 74 6f 20 58 2c 20 70 61 72  l goes to X, par
0490: 74 69 61 6c 20 74 6f 20 59 29 0d 0a c3 b7 20 20  tial to Y)..÷  
04a0: 20 20 20 20 20 20 20 20 3b 20 30 33 3a 20 44 69          ; 03: Di
04b0: 76 69 64 65 20 70 61 72 74 69 61 6c 20 62 79 20  vide partial by 
04c0: 74 6f 74 61 6c 0d 0a 31 30 30 20 20 20 20 20 20  total..100      
04d0: 20 20 3b 20 30 34 3a 20 45 6e 74 65 72 20 31 30    ; 04: Enter 10
04e0: 30 0d 0a c3 97 20 20 20 20 20 20 20 20 20 20 3b  0..×          ;
04f0: 20 30 35 3a 20 4d 75 6c 74 69 70 6c 79 20 62 79   05: Multiply by
0500: 20 31 30 30 20 66 6f 72 20 70 65 72 63 65 6e 74   100 for percent
0510: 61 67 65 0d 0a 52 54 4e 20 20 20 20 20 20 20 20  age..RTN        
0520: 3b 20 30 36 3a 20 52 65 74 75 72 6e 0d 0a 60 60  ; 06: Return..``
0530: 60 0d 0a 0d 0a f0 9f a4 a6 e2 80 8d e2 99 82 ef  `....🤦‍♂
0540: b8 8f 20 49 74 20 68 61 73 20 63 6f 6e 66 75 73   It has confus
0550: 65 64 20 31 2f f0 9d 91 a5 20 77 69 74 68 20 72  ed 1/𝑥 with r
0560: 6f 6c 6c 2d 64 6f 77 6e 2c 20 62 75 74 20 69 74  oll-down, but it
0570: 20 74 6f 6f 6b 20 6d 79 20 67 65 6e 74 6c 65 20   took my gentle 
0580: 63 6f 72 72 65 63 74 69 6f 6e 20 67 72 61 63 69  correction graci
0590: 6f 75 73 6c 79 20 61 6e 64 20 6d 61 64 65 20 74  ously and made t
05a0: 68 65 20 70 72 6f 70 65 72 20 66 69 78 2e 0d 0a  he proper fix...
05b0: 0d 0a 49 20 77 61 73 20 74 68 65 6e 20 61 62 6c  ..I was then abl
05c0: 65 20 74 6f 20 63 6f 6e 76 69 6e 63 65 20 69 74  e to convince it
05d0: 20 74 68 61 74 20 48 50 20 63 61 6c 63 75 6c 61   that HP calcula
05e0: 74 6f 72 73 20 6f 66 20 74 68 69 73 20 65 72 61  tors of this era
05f0: 20 63 6f 75 6c 64 6e e2 80 99 74 20 69 6e 70 75   couldn’t inpu
0600: 74 20 31 30 30 20 61 73 20 61 20 73 69 6e 67 6c  t 100 as a singl
0610: 65 20 69 6e 73 74 72 75 63 74 69 6f 6e 2c 20 62  e instruction, b
0620: 75 74 20 68 61 64 20 74 6f 20 62 65 20 67 69 76  ut had to be giv
0630: 65 6e 20 74 68 65 20 64 69 67 69 74 73 20 73 65  en the digits se
0640: 70 61 72 61 74 65 6c 79 2c 20 61 64 64 69 6e 67  parately, adding
0650: 20 74 77 6f 20 69 6e 73 74 72 75 63 74 69 6f 6e   two instruction
0660: 73 2e 0d 0a 0d 0a 49 74 20 74 6f 6f 6b 20 63 6f  s.....It took co
0670: 6e 73 69 64 65 72 61 62 6c 79 20 6d 6f 72 65 20  nsiderably more 
0680: 70 72 6f 6d 70 74 69 6e 67 20 74 6f 20 67 65 74  prompting to get
0690: 20 69 74 20 74 6f 20 75 6e 64 65 72 73 74 61 6e   it to understan
06a0: 64 20 74 68 61 74 20 69 74 20 63 6f 75 6c 64 20  d that it could 
06b0: 73 61 76 65 20 61 20 70 72 6f 67 72 61 6d 20 73  save a program s
06c0: 74 65 70 20 77 69 74 68 20 45 45 58 20 61 6e 64  tep with EEX and
06d0: 20 69 74 73 20 69 6d 70 6c 69 65 64 20 e2 80 9c   its implied “
06e0: 31 e2 80 9d 20 69 6e 70 75 74 2c 20 61 6e 64 20  1” input, and 
06f0: 49 20 68 61 64 20 74 6f 20 68 61 6e 64 2d 77 72  I had to hand-wr
0700: 69 74 65 20 74 68 65 20 70 72 6f 67 72 61 6d 20  ite the program 
0710: 73 70 65 63 2c 20 62 75 74 20 49 20 66 69 6e 64  spec, but I find
0720: 20 74 68 65 20 72 65 73 75 6c 74 20 73 74 72 61   the result stra
0730: 69 67 68 74 66 6f 72 77 61 72 64 20 61 6e 64 20  ightforward and 
0740: 73 61 74 69 73 66 61 63 74 6f 72 79 3a 0d 0a 0d  satisfactory:...
0750: 0a 60 60 60 0d 0a 4c 42 4c 20 54 20 20 20 20 20  .```..LBL T     
0760: 20 3b 20 30 31 3a 20 70 65 72 63 65 6e 74 20 6f   ; 01: percent o
0770: 66 20 74 68 65 20 74 6f 74 61 6c 20 28 25 54 29  f the total (%T)
0780: 20 69 6e 20 59 2c 20 77 69 74 68 20 70 61 72 74   in Y, with part
0790: 69 61 6c 20 76 61 6c 75 65 20 69 6e 20 58 0d 0a  ial value in X..
07a0: 78 3c 3e 79 20 20 20 20 20 20 20 3b 20 30 32 3a  x<>y       ; 02:
07b0: 20 73 77 61 70 20 74 6f 74 61 6c 20 69 6e 74 6f   swap total into
07c0: 20 58 2c 20 70 61 72 74 69 61 6c 20 69 6e 74 6f   X, partial into
07d0: 20 59 0d 0a c3 b7 20 20 20 20 20 20 20 20 20 20   Y..÷          
07e0: 3b 20 30 33 3a 20 67 65 74 20 64 65 63 69 6d 61  ; 03: get decima
07f0: 6c 20 66 6f 72 6d 20 6f 66 20 61 6e 73 77 65 72  l form of answer
0800: 0d 0a 45 45 58 20 20 20 20 20 20 20 20 3b 20 30  ..EEX        ; 0
0810: 34 3a 20 69 6e 70 75 74 20 61 20 70 6f 77 65 72  4: input a power
0820: 2d 6f 66 2d 31 30 20 76 61 6c 75 65 2e 2e 2e 0d  -of-10 value....
0830: 0a 32 20 20 20 20 20 20 20 20 20 20 3b 20 30 35  .2          ; 05
0840: 3a 20 2e 2e 2e 77 69 74 68 20 65 78 70 6f 6e 65  : ...with expone
0850: 6e 74 20 32 20 3d 20 31 30 30 0d 0a c3 97 20 20  nt 2 = 100..×  
0860: 20 20 20 20 20 20 20 20 3b 20 30 36 3a 20 6d 75          ; 06: mu
0870: 6c 74 69 70 6c 79 20 74 6f 20 67 65 74 20 70 65  ltiply to get pe
0880: 72 63 65 6e 74 61 67 65 0d 0a 52 54 4e 20 20 20  rcentage..RTN   
0890: 20 20 20 20 20 3b 20 30 37 3a 20 72 65 74 75 72       ; 07: retur
08a0: 6e 20 25 54 20 69 6e 20 58 0d 0a 60 60 60 0d 0a  n %T in X..```..
08b0: 0d 0a 54 68 65 20 74 68 69 6e 67 20 69 73 2c 20  ..The thing is, 
08c0: 74 68 65 72 65 20 69 73 20 61 6e 20 65 76 65 6e  there is an even
08d0: 20 6d 6f 72 65 20 65 66 66 69 63 69 65 6e 74 20   more efficient 
08e0: 66 6f 72 6d 20 64 75 65 20 74 6f 20 e2 80 9c 74  form due to “t
08f0: 6f 6e 79 28 6e 7a 29 e2 80 9d 20 6f 6e 20 74 68  ony(nz)” on th
0900: 65 20 6f 6c 64 20 48 50 20 4d 75 73 65 75 6d 20  e old HP Museum 
0910: 66 6f 72 75 6d 20 69 6e 20 70 6f 73 74 20 23 39  forum in post #9
0920: 20 6f 66 20 5b 74 68 69 73 20 74 68 72 65 61 64   of [this thread
0930: 5d 28 68 74 74 70 73 3a 2f 2f 77 77 77 2e 68 70  ](https://www.hp
0940: 6d 75 73 65 75 6d 2e 6f 72 67 2f 63 67 69 2d 62  museum.org/cgi-b
0950: 69 6e 2f 61 72 63 68 76 30 31 37 2e 63 67 69 3f  in/archv017.cgi?
0960: 72 65 61 64 3d 31 31 33 37 38 39 29 3a 0d 0a 0d  read=113789):...
0970: 0a 60 60 60 0d 0a 4c 42 4c 20 54 20 20 20 20 20  .```..LBL T     
0980: 20 3b 20 30 31 3a 20 70 65 72 63 65 6e 74 20 6f   ; 01: percent o
0990: 66 20 74 68 65 20 74 6f 74 61 6c 20 28 25 54 29  f the total (%T)
09a0: 20 69 6e 20 59 2c 20 77 69 74 68 20 70 61 72 74   in Y, with part
09b0: 69 61 6c 20 76 61 6c 75 65 20 69 6e 20 58 0d 0a  ial value in X..
09c0: 31 2f f0 9d 91 a5 20 20 20 20 20 20 20 20 3b 20  1/𝑥        ; 
09d0: 30 32 3a 20 74 61 6b 65 20 72 65 63 69 70 72 6f  02: take recipro
09e0: 63 61 6c 20 6f 66 20 74 6f 74 61 6c 3a 20 31 2f  cal of total: 1/
09f0: 74 6f 74 61 6c 20 28 77 69 74 68 20 70 61 72 74  total (with part
0a00: 69 61 6c 20 69 6e 20 59 29 0d 0a 25 20 20 20 20  ial in Y)..%    
0a10: 20 20 20 20 20 20 3b 20 30 33 3a 20 63 61 6c 63        ; 03: calc
0a20: 75 6c 61 74 65 20 70 61 72 74 69 61 6c 25 20 6f  ulate partial% o
0a30: 66 20 28 31 2f 74 6f 74 61 6c 29 20 67 69 76 69  f (1/total) givi
0a40: 6e 67 0d 0a 20 20 20 20 20 20 20 20 20 20 20 3b  ng..           ;
0a50: 20 20 20 20 20 28 70 61 72 74 69 61 6c 2f 31 30       (partial/10
0a60: 30 29 20 c3 97 20 28 31 2f 74 6f 74 61 6c 29 20  0) × (1/total) 
0a70: 3d 20 70 61 72 74 69 61 6c 2f 28 31 30 30 c3 97  = partial/(100×
0a80: 74 6f 74 61 6c 29 0d 0a 31 2f f0 9d 91 a5 20 20  total)..1/𝑥  
0a90: 20 20 20 20 20 20 3b 20 30 34 3a 20 66 6c 69 70        ; 04: flip
0aa0: 20 74 68 61 74 20 74 6f 20 67 69 76 65 20 74 68   that to give th
0ab0: 65 20 69 6e 74 65 6e 64 65 64 20 63 61 6c 63 75  e intended calcu
0ac0: 6c 61 74 69 6f 6e 0d 0a 52 54 4e 20 20 20 20 20  lation..RTN     
0ad0: 20 20 20 3b 20 30 35 3a 20 72 65 74 75 72 6e 20     ; 05: return 
0ae0: 25 54 20 69 6e 20 58 0d 0a 60 60 60 0d 0a 0d 0a  %T in X..```....
0af0: 53 74 65 70 20 33 20 69 73 20 77 68 65 72 65 20  Step 3 is where 
0b00: 74 68 65 20 6d 61 67 69 63 20 68 61 70 70 65 6e  the magic happen
0b10: 73 2c 20 61 6e 64 20 49 20 63 6f 6e 66 65 73 73  s, and I confess
0b20: 20 74 6f 20 6e 65 65 64 69 6e 67 20 74 68 65 20   to needing the 
0b30: 41 49 20 74 6f 20 65 78 70 6c 61 69 6e 20 69 74  AI to explain it
0b40: 20 74 6f 20 6d 65 20 62 65 66 6f 72 65 20 49 20   to me before I 
0b50: 63 6f 75 6c 64 20 63 6f 6d 6d 65 6e 74 20 69 74  could comment it
0b60: 20 70 72 6f 70 65 72 6c 79 2e 0d 0a 0d 0a 42 72   properly.....Br
0b70: 69 6c 6c 69 61 6e 74 21 20 45 69 67 68 74 20 69  illiant! Eight i
0b80: 6e 73 74 72 75 63 74 69 6f 6e 73 20 66 6f 72 20  nstructions for 
0b90: 74 68 65 20 6e 61 26 69 75 6d 6c 3b 76 65 20 76  the na&iuml;ve v
0ba0: 65 72 73 69 6f 6e 20 64 6f 77 6e 20 74 6f 20 66  ersion down to f
0bb0: 69 76 65 2e 0a 5a 20 62 33 34 32 31 64 65 37 35  ive..Z b3421de75
0bc0: 35 35 33 39 30 61 34 65 32 30 35 36 66 30 34 65  55390a4e2056f04e
0bd0: 33 65 35 36 35 33 34 0a                          3e56534.