(HP-67) Base Conversion - Thomas Klemm - 10-21-2015 09:08 PM
This program is based on the thread HP-67 Base Conversion from HP Key Notes.
Code:
001 *LBL A
002 STO 3 ; new base
003 RDN ; old base
004 STO 1 ; from
005 ENTER
006 GSB 3 ; 10^m base
007 GSB 0 ; convert n from old base to 10^m base
008 RCL 3 ; new base
009 GSB 3 ; 10^k base
010 STO 1 ; from
011 RCL 3 ; new base
012 *LBL 0 ; convert ( n_from from to -- n_to )
013 STO 2 ; to
014 - ; p = from - to
015 X<>Y ; n_from
016 STO 0 ; n_to
017 *LBL 1 ; begin loop
018 RCL 1 ; from
019 x<>y
020 RCL 2 ; to
021 /
022 INT ; n' = n >> 1
023 x=0
024 GTO 2 ; exit loop
025 RDN
026 * ; p' = p * from
027 RDN
028 * ; n' * p'
029 STO+ 0 ; n_to = n_to + n' * p'
030 RDN
031 GTO 1 ; end loop
032 *LBL 2 ; exit
033 RCL 0 ; n_to
034 RTN
035 *LBL 3 ; find power of 10 base
036 1
037 -
038 LOG
039 INT
040 1
041 +
042 10^x
043 RTN
Example: 3258 to base 3
325 ENTER
8 ENTER
3 A
21220
RE: (HP-67) Base Conversion - ggauny@live.fr - 10-24-2017 10:58 AM
Hi Thomas,
How type "STO+ 0" on a HP 67 ?
Code:
Thomas Klemm Offline
Senior Member
Posts: 953
Joined: Dec 2013
(HP-67) Base Conversion
This program is based on the thread HP-67 Base Conversion from HP Key Notes.
Code:
001 *LBL A
002 STO 3 ; new base
003 RDN ; old base
004 STO 1 ; from
005 ENTER
006 GSB 3 ; 10^m base
007 GSB 0 ; convert n from old base to 10^m base
008 RCL 3 ; new base
009 GSB 3 ; 10^k base
010 STO 1 ; from
011 RCL 3 ; new base
012 *LBL 0 ; convert ( n_from from to -- n_to )
013 STO 2 ; to
014 - ; p = from - to
015 X<>Y ; n_from
016 STO 0 ; n_to
017 *LBL 1 ; begin loop
018 RCL 1 ; from
019 x<>y
020 RCL 2 ; to
021 /
022 INT ; n' = n >> 1
023 x=0
024 GTO 2 ; exit loop
025 RDN
026 * ; p' = p * from
027 RDN
028 * ; n' * p'
029 STO+ 0 ; n_to = n_to + n' * p'
030 RDN
031 GTO 1 ; end loop
032 *LBL 2 ; exit
033 RCL 0 ; n_to
034 RTN
035 *LBL 3 ; find power of 10 base
036 1
037 -
038 LOG
039 INT
040 1
041 +
042 10^x
043 RTN
Example: 3258 to base 3
325 ENTER
8 ENTER
3 A
21220
See STEP 029
RE: (HP-67) Base Conversion - ggauny@live.fr - 10-24-2017 11:38 AM
Hi,
I think I have founded a solution,
I replacement 29 STO+ 2
by 29 RCL 0
30 +
31 STO 0
I obtain the good result from example.
STO+ nnn is a command only in HP 97, 41 etc.
RE: (HP-67) Base Conversion - Joe Horn - 10-24-2017 12:56 PM
(10-24-2017 10:58 AM)ggauny@live.fr Wrote: How type "STO+ 0" on a HP 67 ? ... STO+ nnn is a command only in HP 97, 41 etc.
The HP-67 can do STO+0 (and everything else) just as well as the HP-97. The 67 and 97 have identical command sets. Perhaps you are thinking of some other model?
RE: (HP-67) Base Conversion - ggauny@live.fr - 10-24-2017 03:20 PM
Thanks,
You are right,
I had completely forget this command !!!
|