fork download
  1. PROGRAM nibunhou_1
  2. !***** declaration of variables ***************************
  3. IMPLICIT NONE
  4. REAL(8) a,b,c,FXa,FXb,FXc
  5. REAL(8):: EPS=1.0D-10
  6. INTEGER I
  7. !***** initial conditions *********************************
  8. a=-10.0D0
  9. b=10.0D0
  10. !***** repeated calculations ******************************
  11. DO I=1,100
  12. FXa=exp(a)-1.0
  13. FXb=exp(b)-1.0
  14. c=(a+b)/2.0
  15. FXc=exp(c)-1.0
  16. if (FXa*FXc<=0) then
  17. b=c
  18. else
  19. a=c
  20. end if
  21.  
  22. if(ABS(b-a)<EPS) EXIT
  23. end do
  24. write(*,*) c
  25. end program nibunhou_1
  26.  
  27.  
Success #stdin #stdout 0s 5288KB
stdin
Standard input is empty
stdout
  -7.2759576141834259E-011