Post Reply 
What Am I Missing (HP-71B)
11-03-2014, 10:21 PM
Post: #7
RE: What Am I Missing (HP-71B)
(11-03-2014 03:20 PM)Sylvain Cote Wrote:  cruff was faster than me and he is right.

The following program should do what you where searching for ...

10 OPTION BASE 0
20 DIM A(1), B(1)
30 A(0)=4 @ A(1)=4 @ B(0)=5 @ B(1)=4
40 R=0 @ CALL SBD(R,A,B) @ DISP R
200 SUB SBD(Z,X(),Y()) @ Z=X(0)*Y(0)+X(1)*Y(1) @ END SUB

Sylvain

Thanks, both cruff and Sylvain; you're right, that does exactly what I want.

The two things I'd missed were:

1) The need to pass arrays by reference, and the consequent need to use a subprogram with an output parameter, and

2) The fact that DEF FN doesn't allow keyboard execution, only use as a program statement (that's why my simple non-array example was failing).

Interestingly the manual says, "A function can be executed only when it is referenced in a numeric or string expression, either in a program or from the keyboard." (p. 218) which, along with the examples at the bottom of that page, to believe that a UDF could be defined from the keyboard - but it can't, only executed. (Which leads me to a question I'm going to have to explore further - does the UDF exist only within the scope of the program that defines it? A collection of UDF's that are executable in CALC mode would be handy, but I guess that's not how it works.)

Thanks again - and btw, I did that little lecture on dot products using a 32SII, which fit in my jacket pocket a bit more neatly than the 71, anyway. Wink

--- Les
[http://www.lesbell.com.au]
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
What Am I Missing (HP-71B) - Les Bell - 11-03-2014, 04:53 AM
RE: What Am I Missing (HP-71B) - Les Bell - 11-03-2014, 10:45 AM
RE: What Am I Missing (HP-71B) - cruff - 11-03-2014, 01:41 PM
RE: What Am I Missing (HP-71B) - Les Bell - 11-03-2014 10:21 PM
RE: What Am I Missing (HP-71B) - Les Bell - 11-04-2014, 01:01 AM
RE: What Am I Missing (HP-71B) - Joe Horn - 11-05-2014, 05:25 AM
RE: What Am I Missing (HP-71B) - Les Bell - 11-05-2014, 07:24 AM



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