Golden Section Search Method: Fortran f90

Consider the nonlinear equation f(x)=4x2 –exp(x). Write a Fortran program that uses the Golden Section Search Method to find the solution accurate to within 10-6 for the nonlinear equation on [4,8]. 

Sauce Code:

Program  Assignmentq2

implicit none

real:: f

real::x, r, q1, q2,a, b, tol=1.0e-6

!Define Interval and Function

f(x) = 4*x**2-exp(x)

a=4

b=8

print*, "a", a, "b", b

!Evaluation of the function at the end point

r=(sqrt(5.0)-1)/2

q1=b-r*(b-a)

q2=a+r*(b-a)

 print*, "q1",q1, "q2", q2

 ! Creating Loop

!if ((b-a)<=tol) stop

do while ((b-a)>tol)

     !if(f(a)*f(b)<=0) then

     if(f(a)*f(q2)<=0) then

         b=q2

         q2=q1

         q1=b-r*(b-a)

     else

         a=q1

         q1=q2

         q2=a+r*(b-a)

    print*, "q1",q1, "q2", q2, "a", a, "b", b

     end if 

     end do

end program assignmentq2