Sunday, October 13, 2013

Interesting Base Conversions - Porting a 1975 HP 25 Program to the HP 35S

Sometimes simple is best.

Base N to Base 10
Source: HP 25 Applications, 1975, pg. 22
Credit to Hewlett Packard Company
10/8/2013

Instructions:
Store the base of the number to be converted in B.
Start with the left most integer, press XEQ B. For each successive integer, press R/S. This is the integer portion.
Start with the left most fractional part, press XEQ B016. For each successive fractional digit, press R/S.

Examples:
1777 base 8 → 1023
143.2044 base 5 → 48.4384
1.11011 base 2 → 1.84375
B3A.F base 16 → 3131.9375

Program:
B001 LBL B
B002 STO A
B003 RCL B
B004 ENTER
B005 ENTER
B006 ENTER
B007 RCL A
B008 R/S
B009 STO A
B010 CLx
B011 +
B012 x
B013 RCL A
B014 +
B015 GTO B008
B016 RCL B
B017 1/x
B018 STO C
B019 STO D
B020 x
B021 R/S
B022 RCL C
B023 RCL D
B024 x
B025 STO D
B026 x
B027 +
B028 GTO B021


Base 10 to Base N
Source: HP 25 Applications, 1975, pg. 24
Credit to Hewlett Packard Company
10/8/2013

Instructions:
1. Store the number to be converted in A
2. Store the desired base in B
3. Press R/S stop. The approximation will build and keep building indefinitely until stopped.

Examples:
67.32 → 4 03. 05 01 14 11 base 16 (≈43.51EA base 16)
π ≈ 11.001001 base 2

√2 ≈ 1.0110101 base 2

Program:
T001 LBL T
T002 RCL B
T003 10
T004 x≥y?
T005 GTO T007
T006 100
T007 STO C
T008 0
T009 STO D
T010 RCL A
T011 LN
T012 RCL B
T013 LN
T014 ÷
T015 x<0?
T016 GTO T019
T017 IP
T018 GTO T022
T019 IP
T020 1
T021 -
T022 STO E
T023 RCL C
T024 x<>y
T025 y^x
T026 RCL D
T027+
T028 STO D
T029 PSE
T030 RCL B
T031 RCL E
T032 y^x
T033 STO - A
T034 GTO T010



This blog is property of Edward Shore. 2013

No comments:

Post a Comment

HP Prime and TI-84 Plus: Basic Wheatstone Full Bridge Circuit

HP Prime and TI-84 Plus:  Basic Wheatstone Full Bridge Circuit The program WHEATSTONE (HP Prime) and WHTSTONE (TI-84 Plus CE) deals wi...