- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
there is no difference between asd(), msd()
but why they print out different results?
thanks a lot.
a poor man
! result---------------------
1.23456001281738
0.000000000000000E+000
! code --------------------------------
program main
double precision time
time = asd()
print *, time
time = msd()
print *, time
end program main
double precision function asd()
asd = 1.23456
end function asd
double precision function msd()
msd = 1.23456
end function msd
but why they print out different results?
thanks a lot.
a poor man
! result---------------------
1.23456001281738
0.000000000000000E+000
! code --------------------------------
program main
double precision time
time = asd()
print *, time
time = msd()
print *, time
end program main
double precision function asd()
asd = 1.23456
end function asd
double precision function msd()
msd = 1.23456
end function msd
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
there is no difference between asd(), msd() but why they print out different results? thanks a lot. a poor man
! result---------------------
1.23456001281738
0.000000000000000E+000
! code --------------------------------
program main
double precision time
time = asd()
print *, time
time = msd()
print *, time
end program main
double precision functionasd()
asd = 1.23456
end function asd
double precision function msd()
msd = 1.23456
end function msd
! result---------------------
1.23456001281738
0.000000000000000E+000
! code --------------------------------
program main
double precision time
time = asd()
print *, time
time = msd()
print *, time
end program main
double precision functionasd()
asd = 1.23456
end function asd
double precision function msd()
msd = 1.23456
end function msd
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You need to add:
double precision msd
to the main program. msd should also use:
msd = 1.23456D0
otherwise you are assigning a single precision value to a double precision variable.
Steve
double precision msd
to the main program. msd should also use:
msd = 1.23456D0
otherwise you are assigning a single precision value to a double precision variable.
Steve

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page