The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 795 - File: showthread.php PHP 7.4.33 (FreeBSD)
File Line Function
/showthread.php 795 errorHandler->error





Post Reply 
(HP-67) Base Conversion
10-21-2015, 09:08 PM
Post: #1
(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
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(HP-67) Base Conversion - Thomas Klemm - 10-21-2015 09:08 PM
RE: (HP-67) Base Conversion - Joe Horn - 10-24-2017, 12:56 PM



User(s) browsing this thread: 3 Guest(s)