Member-only story
šµāš« There Is No One Rounding StandardĀ InĀ Programming
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: