Section 12: Subroutines179
        Subroutines Inside The
Program File
     
  LBLTTEST         LBLTTEST      
 
  XEQ 01     
     
 
  XEQ 01     
     
 
 
 
RTN    
 
RTN   This subroutine has a
numeric label. Because it
is at the end of the
program file, it is
terminated with END .
 
     LBL 01     
This subroutine has a
numeric label and is
terminated with RTN .
 
     LBL 01     
 
     RTN  
     
     END  
   
  END                
                Subroutines Outside The
Program File
           
LBLTTEST            This subroutine
has an ALPHA
label and is
terminated
with END .
LBLTTEST                 
LBLTABC
LBLTABC These subroutines
have ALPHA labels
grouped together,
only the final one
must be terminated
with END .
XEQTABC XEQTABC
END
RTN
END XEQTDEF
LBLTDEF
END END
Example: A quadratic equation is of the form ax2 + bx + c = 0. One way to find its roots is by using the formulas:
      – b + √(b2 – 4ac)       – b – √(b2 – 4ac)    
  r1 =
 
and r2 =
 
 .  
      2a       2a    
Notice the similarity between the solutions for r1 and r2. The program below prompts you for the values of a, b, and c, stores those values in storage registers R01, R02, and R03, and solves for the real roots r1 and r2.  
 
   Some values of a, b, and c may result in misleading answers because their solutions require greater than 12 digits of accuracy.