(11C/12C/17B/65) Base Conversion
01-19-2014, 06:45 PM (This post was last modified: 02-23-2024 12:12 PM by Thomas Klemm.)
Post: #1
 Thomas Klemm Senior Member Posts: 2,101 Joined: Dec 2013
(11C/12C/17B/65) Base Conversion
Description:
This program allows to convert numbers from one base to another.

Register:
Reg 1: from-base
Reg 2: to-base

Program:
STO 0
RCL 1
RCL 2
-
x<>y
LBL 0
RCL 1
x<>y
RCL 2
÷
INT
x=0
GTO 1
R↓
×
R↓
×
STO + 0
R↓
GTO 0
LBL 1
RCL 0

Examples:
Dec - Bin
Reg 1: 10
Reg 2: 2
21 - 10101

Hex - Dec
Reg 1: 16
Reg 2: 100
0xCAFE = 12:10:15:14
12101514 - 51966
06-21-2014, 10:21 PM (This post was last modified: 06-21-2014 11:02 PM by Thomas Klemm.)
Post: #2
 Thomas Klemm Senior Member Posts: 2,101 Joined: Dec 2013
Base Conversion for HP-12C
Code:
01 -    44  0  STO 0 02 -    45  1  RCL 1 03 -    45  2  RCL 2 04 -       30  − 05 -       34  x<>y 06 -    45  1  RCL 1 07 -       34  x<>y 08 -    45  2  RCL 2 09 -       10  ÷ 10 -    43 25  INTG 11 -    43 35  x=0 12 - 43,33 20  GTO 20 13 -       33  R↓ 14 -       20  × 15 -       33  R↓ 16 -       20  × 17 - 44 40  0  STO+ 0 18 -       33  R↓ 19 - 43,33 06  GTO 06 20 -    45  0  RCL 0

Example: 201410 → 37368
10 STO 1
8 STO 2
2014 R/S

This is another solution that uses the function NPV:
Code:
01 -       36  ENTER 02 -       36  ENTER 03 -    45 15  RCL FV 04 -       10  ÷ 05 -    43 25  INTG 06 -    43 13  CFo 07 -    45 15  RCL FV 08 -       10  ÷ 09 -    43 25  INTG 10 -    43 35  x=0 11 - 43,33 14  GTO 14 12 -    43 14  CFj 13 - 43,33 07  GTO 07 14 -       33  R↓ 15 -        1  1 16 -    45 14  RCL PMT 17 -       22  1/x 18 -       24  Δ% 19 -    44 12  STO i 20 -       33  R↓ 21 -       33  R↓ 22 -    42 13  NPV 23 -    45 14  RCL PMT 24 -    45 15  RCL FV 25 -       30  − 26 -       20  × 27 -       40  +

Example: 201410 → 37368
10 STO PMT
8 STO FV
2014 R/S
06-21-2014, 10:27 PM
Post: #3
 Thomas Klemm Senior Member Posts: 2,101 Joined: Dec 2013
Base Conversion for HP-17b/17bii
BC:ANS=
N+
(FROM-TO)$$\times$$
$$\Sigma$$(I:0:LOG(N)$$\div$$LOG(TO):1:
L(N:IDIV(N:TO))$$\times$$FROM^I
​)

Example: DEC → OCT
Code:
         2014 +   2 *   251 +  20 *    31 + 200 *     3          ----          3736

10 → FROM
8 → TO
2014 → N
ANS
02-23-2024, 12:10 PM (This post was last modified: 02-24-2024 04:20 AM by Thomas Klemm.)
Post: #4
 Thomas Klemm Senior Member Posts: 2,101 Joined: Dec 2013
Base Conversion for HP-65
Code:
001: 23    : LBL 002: 11    : A 003: 33 01 : STO 1 004: 34 02 : RCL 2 005: 34 03 : RCL 3 006: 51    : - 007: 35 07 : g x<>y 008: 23    : LBL 009: 00    : 0 010: 34 02 : RCL 2 011: 35 07 : g x<>y 012: 34 03 : RCL 3 013: 81    : / 014: 31    : f 015: 83    : INT 016: 00    : 0 017: 35 23 : g x=y 018: 22    : GTO 019: 01    : 1 020: 61    : + 021: 35 08 : g Rv 022: 71    : x 023: 35 08 : g Rv 024: 71    : x 025: 34 01 : RCL 1 026: 61    : + 027: 33 01 : STO 1 028: 35 08 : g Rv 029: 22    : GTO 030: 00    : 0 031: 23    : LBL 032: 01    : 1 033: 34 01 : RCL 1 034: 24    : RTN 035: 23    : LBL 036: 12    : B 037: 34 02 : RCL 2 038: 34 03 : RCL 3 039: 33 02 : STO 2 040: 35 07 : g x<>y 041: 33 03 : STO 3 042: 24    : RTN

Code:
Title: Base Conversion A: convert B: switch C:  D:  E:

Registers

R1: n
R2: from
R3: to

Examples

Base conversion between 40 and 100.

Initialization

40 STO 2
100 STO 3

Encoding

1503243917
A

38631977

Decoding

B
38631977
A

1503243917

References
 « Next Oldest | Next Newest »

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