Aug 28, 2008 #1 arunmd1 Programmer Mar 20, 2008 24 FR Hi I need to round real numbers to 3 decimal places . There is no function round is available in FORTRAN . How to do it ?
Hi I need to round real numbers to 3 decimal places . There is no function round is available in FORTRAN . How to do it ?
Aug 29, 2008 1 #2 xwb Programmer Jul 11, 2002 6,828 GB It is called nint but that rounds to the nearest integer. If you want it to 3 decimal places for calculation, do something like Code: x = nint(x * 1000.0) * 1E-3 If you just want to print to 3DP but keep precision Code: print '(F10.3)', x Upvote 0 Downvote
It is called nint but that rounds to the nearest integer. If you want it to 3 decimal places for calculation, do something like Code: x = nint(x * 1000.0) * 1E-3 If you just want to print to 3DP but keep precision Code: print '(F10.3)', x