PROGRAM FILE 167: EXCEPTION - EVALUATION OF NUMERIC                             
        EXPRESSIONS ACTING AS FUNCTION ARGUMENTS.                               
    ANSI STANDARD 7.5, 8.4, 16.4                                                
                                                                                
THIS PROGRAM TESTS THAT THE RECOVERY PROCEDURES FOR                             
EXCEPTIONS OCCURRING DURING THE EVALUATION OF NUMERIC                           
EXPRESSIONS WORK PROPERLY IN CONTEXTS OTHER THAN SIMPLE                         
ASSIGNMENT OF THE EXPRESSION TO A VARIABLE. SPECIFICALLY,                       
EXPRESSIONS ARE USED AS ARGUMENTS TO FUNCTIONS.                                 
                                                                                
SECTION 167.1: DIVISION BY ZERO IN AN ARGUMENT TO A                             
        USER-DEFINED FUNCTION.                                                  
                                                                                
TO PASS THIS TEST:                                                              
                                                                                
    1) A MESSAGE IDENTIFYING THE EXCEPTION MUST BE                              
       DISPLAYED, AND                                                           
                                                                                
    2) POSITIVE INFINITY MUST BE SUPPLIED AS THE VALUE                          
       OF THE ARGUMENT AND EXECUTION CONTINUES.                                 
                                                                                
                   BEGIN TEST.                                                  
                                                                                
ABOUT TO EVALUATE FNC(5/0), WHERE FNC = COMMON LOG.                             
EXCEPTION SHOULD BE REPORTED NOW:                                               
                                                                                
Division by zero                                                                
                                                                                
RESULT OF FNC(5/0) =  308.255                                                   
                                                                                
IF EXCEPTION REPORTED, AND                                                      
   RESULT = COMMON LOG OF MACHINE INFINITY, THEN                                
*** TEST PASSED ***                                                             
                                                                                
                    END TEST.                                                   
                                                                                
SECTION 167.2: ZERO RAISED TO A NEGATIVE POWER IN AN                            
        ARGUMENT TO AN IMPLEMENTATION-SUPPLIED FUNCTION.                        
                                                                                
TO PASS THIS TEST:                                                              
                                                                                
    1) A MESSAGE IDENTIFYING THE EXCEPTION MUST BE                              
       DISPLAYED, AND                                                           
                                                                                
    2) POSITIVE INFINITY MUST BE SUPPLIED AS THE VALUE                          
       OF THE ARGUMENT AND EXECUTION CONTINUES.                                 
                                                                                
                   BEGIN TEST.                                                  
                                                                                
ABOUT TO EVALUATE ATN(0^(-5)).                                                  
EXCEPTION SHOULD BE REPORTED NOW:                                               
                                                                                
Overflow                                                                        
                                                                                
RESULT OF ATN(0^(-5)) =  1.5708                                                 
                                                                                
IF EXCEPTION REPORTED, THEN                                                     
*** TEST PASSED ***                                                             
                                                                                
                    END TEST.                                                   
                                                                                
END PROGRAM 167                                                                 
