define logical VERIFY
sic\let VERIFY = SIC%VERIFY
sic veri &1
!
define double a[166]
define double b[16,4]
define double c[16,16,16]
define double d[16,16]
DEFINE CHARACTER GAG1*20
DEFINE CHARACTER GAG2*20
define logical log1
define logical log2
!
sic\FOR prec 1 TO 3
    IF (prec.EQ.1) THEN
	SIC PRECISION DOUBLE
	define double epsilon
	let epsilon 2e-16  ! Machine precision is 1/2**53
    ELSE IF (prec.EQ.2) THEN
	SIC PRECISION SINGLE
	define real epsilon
	let epsilon 1e-7  ! Machine precision is 1/2**24
    ELSE IF (prec.EQ.3) THEN
	SIC PRECISION AUTO
	define double epsilon
        let epsilon 2e-16
    ENDIF
    sic\let A = 2*ASIN(1)
    sic\let B = ACOS(-1.0)
    sic\let GAG1 = "C'est tout bon"
    sic\let GAG2 = "C'est pas ca"
    IF (GAG1.EQ.GAG2) THEN
!	BEEP 3
	PAUSE "Error in Math Formula Evaluation (1)"
    ENDIF
    !
    IF (abs(A[9]/PI-1).gt.epsilon.OR.abs(B[3,2]/PI-1).gt.epsilon) THEN
!	BEEP 3
	PAUSE "Error in Math Formula Evaluation (2)"
    ENDIF
    IF (ACOS(-1.0).NE.2*ASIN(1)) THEN
!	BEEP 3
	PAUSE "Error in Math Formula Evaluation (3)"
    ENDIF
    sic\let A = -1
    sic\let B = -1
    IF (10**-A[1]+B[6,3].NE.9) THEN
	PAUSE "Error in Math Formula Evaluation (4)"
    ENDIF
    IF (GAG1.NE."C'est tout bon") THEN
	PAUSE "GAG has been modified"
    ENDIF
    IF (A[1].NE.-1) THEN
	PAUSE 
    ENDIF
    IF (abs((2*ASIN(MIN(MAX(A[1],2),ABS(B[3,3])))+EXP(1-0.))/(PI+EXP(ABS(B[8,1])+2-1-1))-1).gt.epsilon) THEN
	SAY '(2*ASIN(MIN(MAX(A[1],2),ABS(B[3,3]))))' 'PI'
	SAY '(2*ASIN(MIN(MAX(A[1],2),ABS(B[3,3]))))-PI'
	PAUSE "Error in Math Formula Evaluation (5)"
    ENDIF
    sic\delete /var epsilon
    !
    sic\let log1 = yes
    sic\let LOG1 = .FALSE.
    sic\let LOG2 = .TRUE.
    if (.NOT.(.not.(log1.and..not.log2))) then
	say (log1.and..not.log2) 
	PAUSE "Error in Math Formula Evaluation (6)"
    endif
    IF ((GAG1.EQ.GAG2.or.log1.eq.log2).and.pi.eq.(1+2-pi)) THEN
!	BEEP 3
	PAUSE "Error in Math Formula Evaluation (7)"
    ENDIF
    sic\let A[I] = SIN(I*PI|3) 
    sic\let B[I,J] = MAX(I*PI,J)
!
! Check newly implemented implicit transposition
    sic\let B[I,J] I
    sic\let A[5:8] B[3,]
    s\FOR I 5 TO 8
	IF (A[I].NE.3) THEN
	    PAUSE "Error in implicit transposition"
	ENDIF
    NEXT
! Old bug. Now fixed...
    exa b[,2]
! 
    sic\let C[I,J,K] J
    sic\let B  C[,8,13:16]
    s\FOR I 1 TO 16
	s\FOR J 1 to 4
	    IF (B[I,J].NE.8) THEN
		PAUSE "Error in implicit transposition"
	    ENDIF
	NEXT
    NEXT
!
   s\let c = 0
   s\let c[8,,] = pi
   s\for j 1 to 16
   s\for k 1 to 16 by 5
       if (c[8,j,k].ne.pi) then
	  say "s\let c[8,,] = pi"
	  pause "Error in left side implicit transposition"
       endif
   next
   next
   next
!
   s\LET C = 0
   s\LET C[I,J,K] = 1 /WHERE (I.EQ.J)
   sic veri off
   s\for i 1 to 16
   s\for j 1 to 16
   s\for k 1 to 16 by 5
       if (i.eq.j.and.c[i,j,k].ne.1) then
	  pause "Error in LET/WHERE test"
       endif
   next
   next
   next
   sic\let SIC%VERIFY = VERIFY 
next
sic\let SIC%VERIFY = VERIFY 
say " "
say "Successful demo! Bye."
say " "
