Logo

Programming-Idioms

History of Idiom 81 > diff from v49 to v50

Edit summary for version 50 by tkoenig:
New Fortran implementation by user [tkoenig]

Version 49

2019-09-26, 18:53:47

Version 50

2019-09-27, 14:29:26

Idiom #81 Round floating point number to integer

Declare integer y and initialize it with the rounded value of floating point number x .
Ties (when the fractional part of x is exactly .5) must be rounded up (to positive infinity).

Idiom #81 Round floating point number to integer

Declare integer y and initialize it with the rounded value of floating point number x .
Ties (when the fractional part of x is exactly .5) must be rounded up (to positive infinity).

Code
integer :: y

y = nint(x)