HP-65 Financial Software request
01-07-2019, 02:38 PM (This post was last modified: 01-07-2019 02:45 PM by albertofenini.)
Post: #1
 albertofenini Member Posts: 261 Joined: Mar 2014
HP-65 Financial Software request
Dear All,
I would like to implement on an HP-65 a software program that given any two of these three values : Cost, Sell, Margin will give in return the third one.
It is a very common function on a Financial Calculator and I'd like to have it on the HP-65
Does anyone has ever done something similar and would like to share ?
Thanks in advance Alberto

Edoardo & Alberto
01-07-2019, 03:39 PM
Post: #2
 Don Shepherd Senior Member Posts: 627 Joined: Dec 2013
RE: HP-65 Financial Software request
(01-07-2019 02:38 PM)albertofenini Wrote:  Dear All,
I would like to implement on an HP-65 a software program that given any two of these three values : Cost, Sell, Margin will give in return the third one.
It is a very common function on a Financial Calculator and I'd like to have it on the HP-65
Does anyone has ever done something similar and would like to share ?
Thanks in advance Alberto
Alberto, I'm not familiar with these financial terms, but if there is a formula that derives them, can't you just program that?
01-07-2019, 03:42 PM
Post: #3
 albertofenini Member Posts: 261 Joined: Mar 2014
RE: HP-65 Financial Software request
definitely there is a formula for this, which I can recover,
but truth is I'm not very good in programming, which is why I was wondering if someone
If no one has ever done it and I will succeed I will post the results
Take care, Alberto

Edoardo & Alberto
01-07-2019, 04:03 PM
Post: #4
 Dave Britten Senior Member Posts: 1,142 Joined: Dec 2013
RE: HP-65 Financial Software request
Margin=(Sell-Cost)/Sell

Plus the other algebraic rearrangements to solve for Sell or Cost.
01-07-2019, 04:26 PM (This post was last modified: 01-07-2019 11:24 PM by Dieter.)
Post: #5
 Dieter Senior Member Posts: 2,398 Joined: Dec 2013
RE: HP-65 Financial Software request
(01-07-2019 02:38 PM)albertofenini Wrote:  I would like to implement on an HP-65 a software program that given any two of these three values : Cost, Sell, Margin will give in return the third one.
It is a very common function on a Financial Calculator and I'd like to have it on the HP-65
Does anyone has ever done something similar and would like to share ?

That's nothing that could not be done within a few minutes. But I would not call this "financial software". ;-)
Here is a possible solution:

Edit: the listing has been corrected.
I forgot that the x≠y? test skips two steps (and not one) if false, so three NOPs had to be added. Also a missing RTN was added.

Code:
LBL       23 A         11 STO 1     33 01 0         00 g x≠y?    35 21 RTN       24 g NOP     35 01 RCL 2     34 02 RCL 2     34 02 RCL 3     34 03 x         71 EEX       43 2         02 ÷         81 -         51 STO 1     33 01 RTN       24 LBL       23 B         12 STO 2     33 02 0         00 g x≠y?    35 21 RTN       24 g NOP     35 01 RCL 1     34 01 1         01 RCL 3     34 03 EEX       43 2         02 ÷         81 -         51 ÷         81 STO 2     33 02 RTN       24 LBL       23 C         13 STO 3     33 03 0         00 g x≠y?    35 21 RTN       24 g NOP     35 01 1         01 RCL 1     34 01 RCL 2     34 02 ÷         81 -         51 EEX       43 2         02 x         71 STO 3     33 03 RTN       24 LBL       23 E         15 DSP       21 .         83 2         02 CLx       44 STO 1     33 01 STO 2     33 02 STO 3     33 03 RTN       24

Initialize (clear all three values) with [E].
Use [A] for cost, [B] for price and [C] for margin.
Rule: enter the unknow value as zero.

Example: cost=40, price=50, margin=?

Start: [E] => 0,00

40 [A] => 0,00
50 [B] => 0,00
[C] => 20,00

So the margin is 20%.
Note that there was no need to enter zero as the display already was 0,00.

What if the margin is increased to 25%?

25 [C] => 0,00
[B] => 53,33

So the price has to be raised to 53,33.

Does this work for you?

Dieter
01-07-2019, 04:30 PM
Post: #6
 albertofenini Member Posts: 261 Joined: Mar 2014
RE: HP-65 Financial Software request
Thank you Dieter !!
That's exactly what I meant, thank you so much,
I have been programming both RPN and AOS in the High School but as of today my skills are
quite "rusty", although I'd like to get those capabilities back.
Thanks again, Alberto

Edoardo & Alberto
01-07-2019, 04:42 PM
Post: #7
 Dieter Senior Member Posts: 2,398 Joined: Dec 2013
RE: HP-65 Financial Software request
(01-07-2019 04:30 PM)albertofenini Wrote:  That's exactly what I meant, thank you so much

My pleasure. ;-)

Please note that two minutes after your reply I added a "clear data" function at LBL E. Don't forget it if you enter the program into your HP65.

Dieter
01-07-2019, 04:44 PM
Post: #8
 albertofenini Member Posts: 261 Joined: Mar 2014
RE: HP-65 Financial Software request
So what exactly is the final listing ?
Thanks again Alberto

Edoardo & Alberto
01-07-2019, 05:35 PM (This post was last modified: 01-07-2019 05:36 PM by Don Shepherd.)
Post: #9
 Don Shepherd Senior Member Posts: 627 Joined: Dec 2013
RE: HP-65 Financial Software request
(01-07-2019 04:03 PM)Dave Britten Wrote:  Margin=(Sell-Cost)/Sell

Dave, thanks for the excellent, simple equation for the 17b solver! "No programming required," as they say.
01-07-2019, 05:48 PM (This post was last modified: 01-08-2019 06:47 PM by Dieter.)
Post: #10
 Dieter Senior Member Posts: 2,398 Joined: Dec 2013
RE: HP-65 Financial Software request
(01-07-2019 04:26 PM)Dieter Wrote:  Use [A] for cost, [B] for price and [C] for margin.
Rule: enter the unknow value as zero.

And finally here is another way of handling input and output with the same label keys: The COMPUTE key, which can be found on some classic, vintage HP65 programs.

Code:
LBL       23 A         11 f-1       32 TF 1      61 STO 1     33 01 RTN       24 f-1       32 SF 1      51 RCL 2     34 02 RCL 2     34 02 RCL 3     34 03 x         71 EEX       43 2         02 ÷         81 -         51 STO 1     33 01 RTN       24 LBL       23 B         12 f-1       32 TF 1      61 STO 2     33 02 RTN       24 RCL 1     34 01 1         01 RCL 3     34 03 EEX       43 2         02 ÷         81 -         51 ÷         81 STO 2     33 02 RTN       24 LBL       23 C         13 f-1       32 TF 1      61 STO 3     33 03 RTN       24 f-1       32 SF 1      51 1         01 RCL 1     34 01 RCL 2     34 02 ÷         81 -         51 EEX       43 2         02 x         71 STO 3     33 03 RTN       24 LBL       23 D         14 f         31 SF 1      51 RTN       24 LBL       23 E         15 DSP       21 .         83 2         02 f-1       32 SF 1      51 0         00 STO 1     33 01 STO 2     33 02 STO 3     33 03 RTN       24

(Edit: corrected keycodes of the final steps)

Initialize (clear all three values) with [E].
Enter cost at [A], price at [B] and margin at [C].

To compute a value use the same keys preceded by [D]. This is the "compute" key. ;-)

Example: cost=40, price=50, margin=?

Start: [E] => 0,00

40 [A] => 40,00
50 [B] => 50,00
[D][C] => 20,00

What's the price for a margin of 25%?

25 [C] => 25,00
[D][B] => 53,33

So the price has to be raised to 53,33.

Dieter
01-07-2019, 05:59 PM
Post: #11
 Dieter Senior Member Posts: 2,398 Joined: Dec 2013
RE: HP-65 Financial Software request
(01-07-2019 04:44 PM)albertofenini Wrote:  So what exactly is the final listing ?

There are two final listings:

Original method (enter 0 for unknown value): cf. post #5
Alternate method (press [D] to compute unknown value): cf. post #10.

I just discovered an error in post #5, but it has been corrected now.
So both listings should be fine. Simply choose your preferred method.

Dieter
01-07-2019, 06:03 PM (This post was last modified: 01-07-2019 06:11 PM by Dieter.)
Post: #12
 Dieter Senior Member Posts: 2,398 Joined: Dec 2013
RE: HP-65 Financial Software request
(01-07-2019 05:35 PM)Don Shepherd Wrote:
(01-07-2019 04:03 PM)Dave Britten Wrote:  Margin=(Sell-Cost)/Sell

Dave, thanks for the excellent, simple equation for the 17b solver! "No programming required," as they say.

I don't know much about the 17b solver, but I suggest changing the formula to

Margin/100 = 1 – (Cost/Sell)

This way each variable occurs only once and the solver can calculate a direct solution.
Also the margin is directly returned in percent.

Dieter
01-07-2019, 06:21 PM (This post was last modified: 01-07-2019 06:22 PM by PedroLeiva.)
Post: #13
 PedroLeiva Member Posts: 137 Joined: Jun 2014
RE: HP-65 Financial Software request
(01-07-2019 04:26 PM)Dieter Wrote:  Example: cost=40, price=50, margin=?

Start: [E] => 0,00

40 [A] => 0,00
50 [B] => 0,00
[C] => 20,00

So the margin is 20%.
Note that there was no need to enter zero as the display already was 0,00.

What if the margin is increased to 25%?

25 [C] => 0,00
[B] => 53,33

So the price has to be raised to 53,33.

Does this work for you?

Dieter
Sorry, it doesn´t work for me. I checked key stroking twice. When I press [C] in the sequence as 4th. step, I got =0, not 20. The same happens when I use HP67
Pedro
01-07-2019, 06:34 PM (This post was last modified: 01-07-2019 06:54 PM by Dieter.)
Post: #14
 Dieter Senior Member Posts: 2,398 Joined: Dec 2013
RE: HP-65 Financial Software request
(01-07-2019 06:21 PM)PedroLeiva Wrote:  Sorry, it doesn´t work for me. I checked key stroking twice. When I press [C] in the sequence as 4th. step, I got =0, not 20.

I have corrected the listing in post #5 about half an hour before you wrote your reply. Maybe you have entered the (erroneous) original listing. There have to be three NOPs that I originally forgot to include.

(01-07-2019 06:21 PM)PedroLeiva Wrote:  The same happens when I use HP67

The HP67 skips one step after a false test, while the HP65 skips two. So the program cannot be directly used on the HP67. However, an adapted version works fine on the HP67 – that's the calculator on which I tested the program. ;-)

Here is an HP67 listing:

Code:
LBL A STO 1 0 x!=y? RTN RCL 2 RCL 2 RCL 3 * EEX 2 / - STO 1 RTN LBL B STO 2 0 x!=y? RTN RCL 1 1 RCL 3 EEX 2 / - / STO 2 RTN LBL C STO 3 0 x!=y? RTN 1 RCL 1 RCL 2 / - EEX 2 * STO 3 RTN LBL E FIX DSP 2 CLX STO 1 STO 2 STO 3 RTN

But on the HP67 I would prefer a different approach using the data entry flag 3.

Dieter
01-07-2019, 07:04 PM
Post: #15
 Dave Britten Senior Member Posts: 1,142 Joined: Dec 2013
RE: HP-65 Financial Software request
(01-07-2019 05:35 PM)Don Shepherd Wrote:
(01-07-2019 04:03 PM)Dave Britten Wrote:  Margin=(Sell-Cost)/Sell

Dave, thanks for the excellent, simple equation for the 17b solver! "No programming required," as they say.

You'll actually find this formula built in to the 17B series already, under "BUS", "MU%P" (markup as percent of price). But that's the underlying formula, useful for inclusion in larger equations that calculate commission or other things.
01-07-2019, 08:01 PM
Post: #16
 SlideRule Senior Member Posts: 903 Joined: Dec 2013
RE: HP-65 Financial Software request
As a side note:

Markup = (Price - Cost) / Cost
Margin = (Price - Cost) / Price

No argument from me, just highlighting a technical distinction in terminology deployed in assorted & various business/finance blogs, where others might. Good discussion.

BEST!
SlideRule
01-07-2019, 08:51 PM
Post: #17
 Thomas Klemm Senior Member Posts: 1,448 Joined: Dec 2013
RE: HP-65 Financial Software request
(01-07-2019 04:26 PM)Dieter Wrote:  Edit: the listing has been corrected.

Code:
… EEX       43 2         02 x         71 STO 3     33 03 LBL       23 E         15 …

There's still missing a RTN statement before LBL E:
Code:
… EEX       43 2         02 x         71 STO 3     33 03 RTN       24 LBL       23 E         15 …

Cheers
Thomas

PS: And I thought that the HP-65 Microcode Emulator is buggy.
01-07-2019, 09:02 PM (This post was last modified: 01-07-2019 09:05 PM by ijabbott.)
Post: #18
 ijabbott Senior Member Posts: 675 Joined: Jul 2015
RE: HP-65 Financial Software request
(01-07-2019 05:35 PM)Don Shepherd Wrote:
(01-07-2019 04:03 PM)Dave Britten Wrote:  Margin=(Sell-Cost)/Sell

Dave, thanks for the excellent, simple equation for the 17b solver! "No programming required," as they say.

Isn't it a built-in app on the 17BII? (BUS -> MU%P) EDIT: Already noted by Dave Britten and SlideRule above.

Here's another handy formula for the solver:

MARKUP=MARGIN×100÷(100-MARGIN)

where Markup=(Sell-Cost)/Cost (i.e. BUS -> MU%C on the 17BII)

— Ian Abbott
01-07-2019, 09:35 PM (This post was last modified: 01-07-2019 09:37 PM by albertofenini.)
Post: #19
 albertofenini Member Posts: 261 Joined: Mar 2014
RE: HP-65 Financial Software request
Dear Dieter,

I have keyed in the program, including the RTN instruction before LBL E as pointed out in one of the latest posts.
I have double checked the listing and recorded on a card, it works but not always, let me explain.

I initialize the program with LBL E
Then I key in 40 LBL A, and then sometimes it returns 0.00, while sometimes it returns 0.03
When it returns 0.00 if I key in 50 LBL B then the program returns 0.00 and pressing C returns the right value as in the example.

However when 0.03 was returned after keying a value for LBL A, even pressing Clx, typing 50 for B will return 0.07 and C
will return a weird value.

Also, if I initialize with E, I press 40 A (cost) and then 25 C (margin desired), pressing
B returns 0 and not the selling value.

I don't want to bother you more than I already did, and I have the HP14B and 10B that have this feature,
but I would like to understand what am I doing wrong, so if you have time I will appreciate any further comment

thanks again to everyone, Alberto

Edoardo & Alberto
01-07-2019, 10:15 PM (This post was last modified: 01-07-2019 10:26 PM by PedroLeiva.)
Post: #20
 PedroLeiva Member Posts: 137 Joined: Jun 2014
RE: HP-65 Financial Software request
(01-07-2019 06:34 PM)Dieter Wrote:  But on the HP67 I would prefer a different approach using the data entry flag 3.

Dieter
It works perfect for HP67. Thank´s. Pedro
To exemplify: I want to get 100, but my partner wants 15%, how much do I have to ask?
Cost= 100
Margin= 15
Price=?
[E] => 0.00
100 [A] => 0.00
15 [C] => 0.00
[B] => 117.65
Because: 117.65 * (1 - 15/100)= 100
 « Next Oldest | Next Newest »

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