Post Reply 
12C vs 11C program, 11C not working
12-16-2018, 03:07 PM (This post was last modified: 12-16-2018 07:47 PM by calcphil12c11c.)
Post: #1
12C vs 11C program, 11C not working
Hello this is my first post here. Have a program that convert Liters to Gallons and displays this as a negative number all the time. This works on my 12C.

I downloaded the 11C app from RLM tools and this is great. I changed the 11C program to have LBL instead of GTO's and it does not work the same. Here are the programs.

HP 12 C

01 ENTER
02 3
03 .
04 7
05 8
06 STO 1
07 X
08 CHS
09 R/S
10 0
11 X exchange Y
12 g X less than or equal Y
13 CHS
14 RCL 1
15 g GTO 07

HP 11C

01 f LBL A
02 ENTER
03 3
04 .
05 7
06 8
07 STO 1
08 f LBL E
09 X
10 CHS
11 R/S
12 0
13 X exchange Y
14 f X less than or equal Y
15 CHS
16 RCL 1
17 GTO E

The 12C program works just fine. GTO 00 and input a number, convert to liters and display a negative liters. Input new number press R/S. The answer is checked to be negative and if yes just keep it negative.

The other program converts Gallons to Liters and shows a positive number all the time just remove line 8 (for 12C) or line 10 (for 11C) along with a new constant in STO 1.

Again, the 12C program works, the 11C program does not.

Same code, just change the GTO's to LBL and GTO.

What am I missing?
Find all posts by this user
Quote this message in a reply
12-16-2018, 10:03 PM (This post was last modified: 12-16-2018 10:16 PM by Dieter.)
Post: #2
RE: 12C vs 11C program, 11C not working
(12-16-2018 03:07 PM)calcphil12c11c Wrote:  Hello this is my first post here.

Welcome to the forum. :-)

(12-16-2018 03:07 PM)calcphil12c11c Wrote:  Have a program that convert Liters to Gallons

No, this program converts gallons to liters. It multiplies the input by 3,78.

(12-16-2018 03:07 PM)calcphil12c11c Wrote:  The 12C program works just fine. GTO 00 and input a number, convert to liters and display a negative liters. Input new number press R/S. The answer is checked to be negative and if yes just keep it negative.

No, the program checks if the number is negative, and if it is, it makes it positive (with the CHS in line 13 of the 12C program).

Anyway, I have read your post several times but I still don't understand where the problem is or what the programs are supposed to do. If you only want to convert from gallons (positive input) to liters (negative output) then the programs can be much shorter:

Code:
01 ENTER   // not really required, but just to be sure...
02 3
03 ,
04 7
05 8
06 5
07 4
08 x
09 CHS
10 GTO 00

Example:
2,5 [R/S] =>   –9,46
3,9 [R/S] => –14,76
0,5 [R/S] =>   –1,89

The final GTO 00 stops the program and returns to the start at line 00, so the next [R/S] will start the program at the beginning again.

For the 11C you may simply add LBL A in the first line and replace GTO 00 with RTN. This does the same thing, it stops and returns to line 000. You may also simply press f[A] for a new calculation.

But again: where exactly is the problem?
Please give a detailled example.

BTW, on the 11C the sequence 0 X↔Y X≤Y? can be replaced with X<0? CHS, or even a single ABS command. On the 12C the sequence x² √x can be used instead.
But again, you don't need all this to convert gallons to negative liters. Take a look at the short program above.

Dieter
Find all posts by this user
Quote this message in a reply
12-16-2018, 11:31 PM (This post was last modified: 12-18-2018 12:44 AM by calcphil12c11c.)
Post: #3
RE: 12C vs 11C program, 11C not working
Sorry.

OK, this is only half the program but the other half is just about the same.

Input 2 gallons, output -7.56. The minus sign signifies Liters.

If you input any + or - number the output is always negative for liters.

****

12C Works fine on 12C

g GTO 00 start...

Display
1 R/S -3.78
2 R/S -7.56 (2 gallons is 7.56 liters)
3 R/S -11.34
4 R/S -15.12

-1 R/S -3.78
-2 R/S -7.56
etc...

11C Does not work here.

1 f A -3.78
2 R/S -14.29
3 R/S -54.01
4 R/S -204.16

-1 R/S -771.72
-2 R/S -2917.10

Only difference is the LBL's...
Find all posts by this user
Quote this message in a reply
12-17-2018, 05:11 AM
Post: #4
RE: 12C vs 11C program, 11C not working
The sequence produced by your HP-11C is:
3.781 = 3.78
3.782 = 14.29
3.783 = 54.01
3.784 = 204.16
3.785 = 771.72
3.786 = 2917.10

I can simulate that behaviour by using SST before R/S:

1 f A -3.78
2 SST 20
R/S -14.29
3 SST 30
R/S -54.01
4 SST 40
R/S -204.16

-1 SST -10
R/S -771.72
-2 SST -20
R/S -2917.10

What happens is that the 0 in line 12 is appended to the input.

However I experience the same behaviour with the HP-12C.

Could you check what happens if you use ENTER to complete your entry?

1 f A -3.78
2 ENTER R/S ?
3 ENTER R/S ?
4 ENTER R/S ?

-1 ENTER R/S ?
-2 ENTER R/S ?

For my tests I used version 1.0.1 of nonpareil for OS X
Copyright 2005-2012 Maciej Bartosiak
based on Nonpareil 0.77 for Linux
Copyright 2004-2006 Eric Smith

Thus the real hardware could behave differently.

Cheers
Thomas
Find all posts by this user
Quote this message in a reply
12-17-2018, 08:38 AM
Post: #5
RE: 12C vs 11C program, 11C not working
It might depend on which model of HP-12C is being used, e.g. "Platinum" versus older models.

— Ian Abbott
Find all posts by this user
Quote this message in a reply
12-17-2018, 08:39 AM
Post: #6
RE: 12C vs 11C program, 11C not working
(12-16-2018 11:31 PM)calcphil12c11c Wrote:  Only difference is the LBL's...

The major difference is that you use a real 12C nit an 11C simulator program. ;-)

1. Place an ENTER before the 0 in your 11C progran. As Thomas already said, this 0 seems to get appended to your input. If this really happens it's a bug in the simulator as on a real hardware 11C the [R/S] key enables stack lift.

So insert an ENTER between R/S and 0. Or, even better, use the X<0? test instead.

2. Please try the programs I posted.

12C:
Code:
01 ENTER
02 3
03 ,
04 7
05 8
06 5
07 4
08 x
09 CHS
10 GTO 00

11C:
Code:
001 LBL A
002 ENTER
003 3
004 ,
005 7
006 8
007 5
008 4
009 x
010 CHS
011 RTN

This is shorter and it should definitely work.

Dieter
Find all posts by this user
Quote this message in a reply
12-17-2018, 12:13 PM (This post was last modified: 12-17-2018 02:06 PM by calcphil12c11c.)
Post: #7
RE: 12C vs 11C program, 11C not working
(12-17-2018 05:11 AM)Thomas Klemm Wrote:  The sequence produced by your HP-11C is:
3.781 = 3.78
3.782 = 14.29
3.783 = 54.01
3.784 = 204.16
3.785 = 771.72
3.786 = 2917.10

I can simulate that behaviour by using SST before R/S:

1 f A -3.78
2 SST 20
R/S -14.29
3 SST 30
R/S -54.01
4 SST 40
R/S -204.16

-1 SST -10
R/S -771.72
-2 SST -20
R/S -2917.10

What happens is that the 0 in line 12 is appended to the input.

However I experience the same behaviour with the HP-12C.

Could you check what happens if you use ENTER to complete your entry?

1 f A -3.78
2 ENTER R/S ?
3 ENTER R/S ?
4 ENTER R/S ?

-1 ENTER R/S ?
-2 ENTER R/S ?

For my tests I used version 1.0.1 of nonpareil for OS X
Copyright 2005-2012 Maciej Bartosiak
based on Nonpareil 0.77 for Linux
Copyright 2004-2006 Eric Smith

Thus the real hardware could behave differently.

Cheers
Thomas

That works! Using ENTER now follows the 12C program.

Can't use the x<0 as the 12C does not have that function.

*If this really happens it's a bug in the simulator as on a real hardware 11C the [R/S] key enables stack lift.*

So on a 'real' 11C the R/S enables a stack lift? Just want to know please.

*** Thank you! ***
Find all posts by this user
Quote this message in a reply
12-17-2018, 07:42 PM (This post was last modified: 12-17-2018 09:22 PM by Dieter.)
Post: #8
RE: 12C vs 11C program, 11C not working
(12-17-2018 12:13 PM)calcphil12c11c Wrote:  That works! Using ENTER now follows the 12C program.

So the 11C simulator is buggy.

(12-17-2018 12:13 PM)calcphil12c11c Wrote:  Can't use the x<0 as the 12C does not have that function.

Sure, that's why I suggested this for the 11C.

But on the 11C you also have an ABS command, so simply replace the three lines that do the test with ABS. This does the same (if negative, make it positive), and you don't have any problems with the simulator bug.

BTW, I suggested "x² √x" as an ABS substitute on the 12C. But the 12C also does not have an x² command, so it's ENTER x √x instead. My bad.

But once again: you do not need all this! It's good practice to end an 12C program with GTO 00 (or an 11C program with RTN). This way the program stops and returns to the program start. The next [R/S] will then restart it from the beginning again. That's a big advantage especially for the 12C. If you observe this good tradition of 12C programming you can re-run a program as often as you like, without any further interaction. That's why I suggested the programs in post #6. They are shorter and do the right thing automatically. No loop, no GTO required, and also no storage registers.

BTW, on the 12C you also do not have to type "GTO 00" manually to reset the program. Simply press f[CL PRGM] in run mode. This resets the program to step 00. Without clearing the program, of course. ;-)

(12-17-2018 12:13 PM)calcphil12c11c Wrote:  *If this really happens it's a bug in the simulator as on a real hardware 11C the [R/S] key enables stack lift.*

So on a 'real' 11C the R/S enables a stack lift? Just want to know please.

Almost all classic HP RPN programmable calculators behave this way. The only exception I know of is the HP25(C) where indeed an ENTER is required. Some users consider this a bug in the HP25 firmware as this is not the way such a calculator should behave.

Finally, here is another version for the 11C that converts both ways, gallons to liters and vice versa. Rule: gallones are positive, liters are negative.

Code:
LBL C
x<0?
1/x
3
,
7
8
5
4
1
2
x
x<0?
1/x
CHS
RTN

Edit: fixed an eror – the CHS command was in the wrong position.

3 f[A] => –11,3562   // 3 gallons are 11,356 liters
   f[A] =>    3,0000   // 11,356 liters are 3 gallons
   f[A] => –11,3562  //  etc.
   ...

–5 f[A] =>   1,3209  //  5 liters are 1,32 gallons

Once run, you can also press [R/S] instead of f[A].

Dieter
Find all posts by this user
Quote this message in a reply
12-17-2018, 09:04 PM
Post: #9
RE: 12C vs 11C program, 11C not working
Thanks again. I will rewrite and try your suggestions.
Find all posts by this user
Quote this message in a reply
12-17-2018, 11:59 PM (This post was last modified: 12-18-2018 01:07 AM by calcphil12c11c.)
Post: #10
RE: 12C vs 11C program, 11C not working
Thank you again. I rewrote your program for the 12C as it does not have the x<0.

Here it is and it works perfect.

01 0
02 X exchange Y
03 X less than or equal Y
04 1/x
05 3
06 .
07 7
08 8
09 5
10 X
11 0
12 X exchange Y
13 X less than or equal Y
14 1/x
15 CHS
16 R/S
17 GTO 01
Find all posts by this user
Quote this message in a reply
12-18-2018, 08:50 AM (This post was last modified: 12-18-2018 09:07 AM by Dieter.)
Post: #11
RE: 12C vs 11C program, 11C not working
(12-17-2018 11:59 PM)calcphil12c11c Wrote:  Thank you again. I rewrote your program for the 12C as it does not have the x<0.
Here it is and it works perfect.

Great. You can remove step 11 and 12 since there still is a zero left in Y from the first x<0? test.
You may insert x=0? GTO 00 as the first lines – this way the program also works for zero input.
And finally you should replace the last two lines with GTO 00. This resets the program to the start after each calculation and you can run it again with a simple R/S just as well.

Dieter
Find all posts by this user
Quote this message in a reply
12-18-2018, 11:55 AM (This post was last modified: 12-18-2018 02:42 PM by calcphil12c11c.)
Post: #12
RE: 12C vs 11C program, 11C not working
(12-18-2018 08:50 AM)Dieter Wrote:  
(12-17-2018 11:59 PM)calcphil12c11c Wrote:  Thank you again. I rewrote your program for the 12C as it does not have the x<0.
Here it is and it works perfect.

Great. You can remove step 11 and 12 since there still is a zero left in Y from the first x<0? test.
You may insert x=0? GTO 00 as the first lines – this way the program also works for zero input.
And finally you should replace the last two lines with GTO 00. This resets the program to the start after each calculation and you can run it again with a simple R/S just as well.

Dieter

I think you want this.

01 g x=0
02 g GTO 00
03 0
04 x <> y
05 g x less than or equal y
06 1/x
07 3
08 .
09 7
10 8
11 5
12 X
13 g x less than or equal y
14 1/x
15 CHS
16 g GTO 00


And yes it works! Again, thank you!
Find all posts by this user
Quote this message in a reply
01-09-2019, 04:19 AM
Post: #13
RE: 12C vs 11C program, 11C not working
Just to let everyone know I reported the above bug to RLM Tools. They have issued a fix and posted it in the APP store. I downloaded it and inputted the original program and the bug is fixed. The RLM Tool 11C emulator program now works like a real 11C and now performs a stack lift after the R/S.
Find all posts by this user
Quote this message in a reply
Post Reply 




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