(15C) another approach to decimal <-> binary conversion
09-01-2018, 06:16 PM
Post: #4
 Thomas Klemm Senior Member Posts: 1,447 Joined: Dec 2013
RE: (15C) another approach to decimal <-> binary conversion
I've taken this generic base conversion program and hard-coded from-base=10 and to-base=2:
Code:
001 -    44  0  STO 0 002 -        8  8 003 -       34  x<>y 004 - 42,21, 0  LBL 0 005 -        1  1 006 -        0  0 007 -       34  x<>y 008 -        2  2 009 -       10  ÷ 010 -    43 44  INT 011 -    43 20  x=0 012 -    22  1  GTO 1 013 -       33  R↓ 014 -       20  × 015 -       33  R↓ 016 -       20  × 017 - 44,40, 0  STO + 0 018 -       33  R↓ 019 -    22  0  GTO 0 020 - 42,21, 1  LBL 1 021 -    45  0  RCL 0

Example

f CLEAR PRGM
47
R/S

101,111.0000

And here's the program for the HP-12C:
Code:
01 -    44  0  STO 0 02 -        8  8 03 -       34  x<>y 04 -        1  1 05 -        0  0 06 -       34  x<>y 07 -        2  2 08 -       10  ÷ 09 -    43 25  INTG 10 -    43 35  x=0 11 - 43,33 19  GTO 19 12 -       33  R↓ 13 -       20  × 14 -       33  R↓ 15 -       20  × 16 - 44 40  0  STO+ 0 17 -       33  R↓ 18 - 43,33 04  GTO 04 19 -    45  0  RCL 0

(11-30-2017 07:50 PM)Dieter Wrote:  Ah, that's what the "8" is for. #-)

It has a different meaning in my program and is actually needed.
 « Next Oldest | Next Newest »

 Messages In This Thread (15C) another approach to decimal <-> binary conversion - jthole - 11-29-2017, 10:32 AM RE: (15C) another approach to decimal <-> binary conversion - Dieter - 11-30-2017, 07:50 PM RE: (15C) another approach to decimal <-> binary conversion - jthole - 12-01-2017, 08:48 AM RE: (15C) another approach to decimal <-> binary conversion - Thomas Klemm - 09-01-2018 06:16 PM

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