BER program listing

 

 

Program:

Comments:

 

 

 

 

 

 

«

 

 

 

→ x

Creates local variable x.

 

 

«

Begins outer defining procedure.

 

 

'x/2' →NUM 2 1

Enters x/2, the first counter value, and

 

 

→ xover2 j sum

the first term of the series, then creates

 

 

 

local variables.

 

 

«

Begins inner defining procedure.

 

 

DO

Begins the loop.

 

 

sum

Recalls the old sum and calculates the

 

 

'sum+(-1)^(j/2)*

new sum.

 

 

xover2^(2*j)/SQ(j!)'

 

 

 

EVAL

 

 

 

2 'j' STO+

Increments the counter.

 

 

DUP 'sum' STO

Stores the new sum.

 

 

UNTIL

Ends the loop clause.

 

 

==

Tests the old and new sums.

 

 

END

Ends the loop.

 

 

sum

Recalls the sum.

 

 

»

Ends inner defining procedure.

 

 

»

Ends outer defining procedure.

 

 

»

 

 

 

 

 

 

 

`OBER K

Stores the program in BER.

 

 

 

 

 

 

Checksum: # 15837d

 

Bytes:

203

 

Example: Calculate BER(3).

J

3%BER%

Calculate BER(2) in algebraic syntax.

O%BER% !Ü2

N

2-30 RPL Programming Examples