# If you will round a half, you will get different result depending on your programming language.

Coding in multiple programming languages gives you a better understanding of how things can be done.

Today I will tell you about something you donât know about rounding numbers. I am sure you donât know it, because I am programming for 20 years now, and didnât know it either.

If you, however, by any chance know it, you can tap you on your shoulder, because like one on 100k developers knows it I guess.

# Rounding

Rounding is a basic mathematical concept that we all know, there is no surprise there. 1.1 becomes 1, 2.7 becomes 3. The trouble begins when you have to round a half of a number, for example 2.5.

Should you round it to 2, or to 3? I donât know about you, but for me the answer is obvious: round it to three.

Interestingly enough, there are many other ways to round a number. Here is an illustration from the Wikipedia page:

--

--

Software Engineer & Tech Editor. Top 2% on StackOverflow, 3mil views on Quora. Won Shattered Pixel Dungeon.