SUBTRACT Examples


Example 1:

 

  

SUBTRACT

SEND(N) FROM RECVING

 

 

Variable

Format

Contents

Before:

SEND(N)

3.1

•45.3

 

RECVING

4.2

••55.65

 

After:

SEND(N)

3.1

•45.3

 

RECVING

4.2

••10.35

 

No Condition Flag is set.

 

Example 2:

 

 

Variable

Format

Contents

Before:

SEND(N)

4

•250

 

RECVING

4.2

-825.33

 

After:

SEND(N)

4

•250

 

RECVING

4.2

1075.33

 

The OVER Condition Flag is set. RECVING was too small to contain -1075.33. The LESS and ZERO Condition Flags are unpredictable.

 

Example 3:

 

  

SUBTRACT

"350.005" FROM RECVING

 

 

Variable

Format

Contents

Before:

RECVING

4.2

•150.26

 

After:

RECVING

4.2

-199.75

 

The LESS Condition Flag is set. RECVING has a negative amount.

 

Example 4:

 

  

SUBTRACT

SEND(N) FROM RECVING,OPTDEST

 

 

Variable

Format

Contents

Before:

SEND(N)

3.1

•45.3

 

RECVING

4.2

••55.65

 

OPTDEST

4.2

••••.00

 

After:

SEND(N)

3.1

•45.3

 

RECVING

4.2

••55.65

 

OPTDEST

4.2

••10.35

 

No Condition Flag is set.

 

Example 5:

 

ARRAY1

FORM

3(10)

ARRAY2

FORM

4(10)

  

...

 

  

SUB

ARRAY1,ARRAY2

 

Performs a standard SUB instruction on each element within each array.

 

 



PL/B Language Reference SUBTITLE Example SWITCH Examples