Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
underoverflow
!gfortran, gcc version 5.4.0 20160609 program epsilon implicit none integer, parameter :: DP=8, SP=4 real(DP) :: eps_d, x_d, xa, x, under_d, over_d real(SP) :: eps_s, x_s, under_s, over_s integer :: i, j read *,x_d,x_s !x_d=4.0_DP !x_s=4.0_SP print *,"x_d=",x_d print *,"x_s=",x_s eps_d=1.0_DP eps_s=1.0_SP do while (1.0_SP+eps_s .gt. 1.0_SP) eps_s=eps_s/2 end do do while (1.0_DP+eps_d .gt. 1.0_DP) eps_d=eps_d/2 end do print *,"single precision epsilon=",eps_s print *,"double precision epsilon=",eps_d x_d=x_d+eps_d x_s=x_s+eps_s print *,"x_d+eps_d=",x_d print *,"x_s+eps_s=",x_s !xa=5.5_DP !x=1.0-xa+(xa*xa)/2.0-(xa*xa*xa)/6.0+(xa*xa*xa*xa)/24.0-(xa*xa*xa*xa*xa)/120.0+ & ! (xa*xa*xa*xa*xa*xa)/720.0-(xa*xa*xa*xa*xa*xa*xa)/5040.0+ & ! (xa*xa*xa*xa*xa*xa*xa*xa)/40320.0-(xa*xa*xa*xa*xa*xa*xa*xa*xa)/362880.0+ & ! (xa*xa*xa*xa*xa*xa*xa*xa*xa*xa)/3628800.0 ! !print *,x !x=1.0+xa+(xa*xa)/2.0+(xa*xa*xa)/6.0+(xa*xa*xa*xa)/24.0+(xa*xa*xa*xa*xa)/120.0+ & ! (xa*xa*xa*xa*xa*xa)/720.0+(xa*xa*xa*xa*xa*xa*xa)/5040.0+ & ! (xa*xa*xa*xa*xa*xa*xa*xa)/40320.0+(xa*xa*xa*xa*xa*xa*xa*xa*xa)/362880.0+ & ! (xa*xa*xa*xa*xa*xa*xa*xa*xa*xa)/3628800.0 !print *,1.0/x,exp(-xa) under_s=1.0_SP under_d=1.0_DP over_s=1.0_SP over_d=1.0_DP do i=1,2000 under_s=under_s/2.0_SP over_s=over_s*2.0_SP if(i.lt.1022) then under_d=under_d/2.0_DP over_d=over_d*2.0_DP else under_d=under_d/1.1_DP over_d=over_d*1.01_DP end if print *,"single precision=",i,under_s,over_s print *,"double precision=",i,under_d,over_d end do end program epsilon
run
|
edit
|
history
|
help
0
Me
4(ii)
Bissection Method
55
my_first_code
C
Title
hello world
Rvc
A_01 CHEBYSHEV_METHOD