Logo

Programming-Idioms

History of Idiom 81 > diff from v48 to v49

Edit summary for version 49 by test:
New Csharp implementation by user [test]

Version 48

2018-04-23, 23:18:50

Version 49

2019-09-26, 18:53:47

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
int x = Math.Round(y);