The Sinister Design Forums

Please login or register.

Login with username, password and session length
Advanced search  

News:

Welcome to the new Sinister Design forums!

Author Topic: Rounding numbers  (Read 2862 times)

Ertxiem

  • Global Moderator
  • Black Cape
  • *****
  • Offline Offline
  • Posts: 627
    • View Profile
Rounding numbers
« on: February 07, 2020, 05:31:31 PM »

While reading the post regarding rounding of numbers:
[...]
-- fixed: Unity was rounding 0.5 down to 0 instead of up to 1, which is apparently because Mathf.RoundToInt() just uses C#'s default rounding, which was designed for banks and not for games.
I recalled that I learned in school the rule to round to the nearest number, with ties going to the even number. I used it in Physics, Chemistry and Statistics.

Curiosity drove me to take a look at Wikipedia. I was able to find that the reported oldest recommendation of rounding to the nearest number, with ties going to the even number was in a book from 1906. Several names are being used for this type of rounding: convergent rounding, statistician's rounding, Dutch rounding, Gaussian rounding, odd–even rounding, or bankers' rounding (this last term having a bit obscure origin, since there is no strong reference about banks using it).
« Last Edit: February 08, 2020, 12:48:14 AM by Ertxiem »
Logged
Ert, the Dead Cow.
With 2 small Mandelbrot sets as the spots.

CraigStern

  • The Creator
  • Administrator
  • General
  • *****
  • Offline Offline
  • Posts: 3567
    • View Profile
    • Sinister Design
Re: Rounding numbers
« Reply #1 on: February 09, 2020, 12:00:15 PM »

That's interesting! In school, I was taught that ties always round upwards (away from 0), which is actually quite commonplace (and at least in this article, referred to as "the common method"). I wasn't even aware that other round methods for x.5 values existed until the other day!
« Last Edit: February 09, 2020, 12:04:20 PM by CraigStern »
Logged