Conversion Routine
07-07-2016, 06:33 PM (This post was last modified: 07-08-2016 06:09 AM by Dieter.)
Post: #8
 Dieter Senior Member Posts: 2,397 Joined: Dec 2013
RE: Conversion Routine
(07-07-2016 05:20 PM)Dieter Wrote:  There are ways to do this without flags, but I fear these will require as least as much steps as the current solution. ;-)

Well, it can be done with the same 35 steps and one data register.

Here is a solution without flags. The idea is that decimal feet are positive and ft.inss are negative. So 1.5208 feet are entered and displayed as 1.5208, while for 1 ft, 6 in and 4/16 it's –1.0604. This way the user always knows how to read a result and, as an additional benefit, two separate starting points are not required.

Code:
01  STO 0 02  EEX 03  2 04  ENTER 05  . 06  1 07  6 08  ENTER 09  1 10  2 11  RCL 0 12  X>0? 13  GTO 21 14  R↓ 15  ENTER 16  R↓ 17  R↓ 18  1/x 19  x<>y 20  RCL 0 21  FRAC 22  * 23  INT 24  x<>y 25  LastX 26  FRAC 27  * 28  + 29  x<>y 30  / 31  RCL 0 32  INT 33  + 34  CHS 35  GTO 00

Enter the program, set FIX 4 and GTO 00

1,5208 [R/S] => –1,0604 = 1 ft 6 in and 4/16
–1,0604 [R/S] =>  1,5208 = 1,5208 ft

Dieter

Edit: Replaced Rdn in listing with R↓
 « Next Oldest | Next Newest »

 Messages In This Thread Conversion Routine - SlideRule - 07-02-2016, 02:45 AM RE: Conversion Routine - Dieter - 07-02-2016, 06:07 AM RE: Conversion Routine - SlideRule - 07-02-2016, 12:43 PM RE: Conversion Routine - Dieter - 07-04-2016, 08:22 PM RE: Conversion Routine - SlideRule - 07-04-2016, 11:31 PM RE: Conversion Routine - SlideRule - 07-07-2016, 01:13 AM RE: Conversion Routine - Dieter - 07-07-2016, 05:20 PM RE: Conversion Routine - Dieter - 07-07-2016 06:33 PM RE: Conversion Routine - SlideRule - 07-08-2016, 12:48 AM RE: Conversion Routine - SlideRule - 07-08-2016, 01:58 PM RE: Conversion Routine - Dieter - 07-08-2016, 06:32 PM RE: Conversion Routine - SlideRule - 07-08-2016, 07:41 PM RE: Conversion Routine - SlideRule - 07-11-2016, 02:52 PM

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