Routines 
Prev: 14410  Up: Map  Next: 14446 
The address of this routine is found in the table of addresses. It is called indirectly via fp_calc_2, and the routine at sqr continues here.
This subroutine performs the binary operation of raising the first number, X, to the power of the second number, Y.
The subroutine treats the result X**Y as being equivalent to EXP (Y*LN X). It returns this value unless X is zero, in which case it returns 1 if Y is also zero (0**0=1), returns zero if Y is positive, and reports arithmetic overflow if Y is negative.


to_power  14417  RST 40  X, Y  
14418  DEFB 1  exchange: Y, X  
14419  DEFB 49  duplicate: Y, X, X  
14420  DEFB 48  f_not: Y, X, (1/0)  
14421  DEFB 0  jump_true to XIS0: Y, X  
14422  DEFB 7  
The jump is made if X=0, otherwise EXP (Y*LN X) is formed.


14423  DEFB 37  ln: Y, LN X  
Giving report A if X is negative.


14424  DEFB 4  multiply: Y*LN X  
14425  DEFB 56  end_calc  
14426  JP exp  Exit via exp to form EXP (Y*LN X).  
The value of X is zero so consider the three possible cases involved.


XIS0  14429  DEFB 2  delete: Y  
14430  DEFB 49  duplicate: Y, Y  
14431  DEFB 48  f_not: Y, (1/0)  
14432  DEFB 0  jump_true to ONE: Y  
14433  DEFB 9  
The jump is made if X=0 and Y=0, otherwise proceed.


14434  DEFB 160  stk_zero: Y, 0  
14435  DEFB 1  exchange: 0, Y  
14436  DEFB 55  greater_0: 0, (1/0)  
14437  DEFB 0  jump_true to LAST: 0  
14438  DEFB 6  
The jump is made if X=0 and Y is positive, otherwise proceed.


14439  DEFB 161  stk_one: 0, 1  
14440  DEFB 1  exchange: 1, 0  
14441  DEFB 5  division: Exit via division as dividing by zero gives 'arithmetic overflow'.  
The result is to be 1 for the operation.


ONE  14442  DEFB 2  delete:   
14443  DEFB 161  stk_one: 1  
Now return with the 'last value' on the stack being 0**Y.


LAST  14444  DEFB 56  end_calc: (1/0)  
14445  RET  Finished: 'last value' is 0 or 1. 
Prev: 14410  Up: Map  Next: 14446 