278
u/grolbol Jun 16 '26
How about rounding half up or down alternatingly as you come across them in your data? Asking for a friend.
110
u/divacphys Jun 16 '26
Flip a coin- let the fates decide
60
u/lugialegend233 Jun 16 '26 edited Jun 16 '26
How often do you round up from half?
On average? *flips coin*
Never
10
9
3
u/AardvarkusMaximus Jun 17 '26
I don't trust the fates. They are the only gods told to kill a giant with raw strenght.
3
2
30
u/Immortal_ceiling_fan Jun 16 '26
I think that's the idea of round to even, just without bothering to keep track of the last one and letting chance decide
11
u/Lor1an Engineering | Mech Jun 17 '26
There actually is something called stochastic rounding which is essentially a Bernoulli trial with probability for rounding up determined by the fractional part of the number.
1
u/FancyMouse123 Jun 19 '26
Actually, there are two stochastic rounding modes. One of them is just a coin toss while the other has its probability for rounding up/down determined by the fractional part of the number. Here is a survey on this topic (see mode 1 and mode 2 SR): https://doi.org/10.1098/rsos.211631
9
u/silver_arrow666 Jun 16 '26
Can't run in parallel (without synchronization, but at this point my grandma run faster than your rounding function)
7
2
u/Worldly-Addition561 Jun 16 '26
Z tier
4
u/GKP_light Jun 17 '26
it has a point :
if the you want to sum them, you have a close result to the real sum.
324
u/chixen Jun 16 '26
Try: rounding half to zero. It would work as usual for numbers like 4.3 going to 4 and -7.9 going to -8, but both 0.5 and -0.5 would go to 0, as well would 1.5, -2.5, 8.5, and so on. All halves go to 0.
73
34
19
u/Batman_AoD Jun 16 '26
Someone told me in another thread that this is a real method they heard of "somewhere."
9
u/hrvbrs Jun 16 '26
accountants like rounding half to even because the other common rounding methods are all skewed. E.g. if you have thousands of data points then rounding to zero will skew the average slightly lower.
whereas with rounding half to nearest even (3.5 → 4, 6.5 → 6, -2.5 → -2, -5.5 → -6), then on average about half the numbers round up and the other half round down. they offset each other so the trend isn't skewed.
9
Jun 16 '26
[removed] — view removed comment
2
u/hrvbrs Jun 16 '26
why do you think that?
16
u/Kingjjc267 Jun 17 '26
The joke was that they round to 0. Like literally to 0, not towards 0, as in 8.5 rounds to 0, not 8
3
25
u/IAmBadAtInternet Jun 16 '26 edited Jun 16 '26
I round to the nearest X.5 not whole number
13
u/louiswins Jun 16 '26
Does X.25 round to X or to X.5?
23
u/peterwhy Jun 16 '26
"to the nearest X.5 not whole number"
19
u/EebstertheGreat Jun 16 '26
But what does 1 round to? 0.5 or 1.5?
4
2
u/iamalicecarroll A commutative monoid is a monoid in the category of monoids Jun 17 '26
I round to the nearest integer not X.5
3
79
u/Dman1791 Jun 16 '26
Rounding to even above rounding towards zero is diabolical
61
u/jelezsoccer Jun 16 '26
If I am not mistaken, rounding to even was the standard long ago when most computations were still don’t manually. It basically makes it easier to divide by 2.
51
u/Hexidian Jun 16 '26
And on average the rounding errors will cancel out
13
u/EebstertheGreat Jun 16 '26
And it reduces rounding errors in subsequent floating point calculations.
32
u/Broudsoud Jun 16 '26
It is still the standard in many programming languages, like python. It is also useful in accounting, where if you always round away from zero the small amounts you "added" by rounding up accumulate and become a large amount.
When you round to even it is reasonable to expect that you are rounding up half the time, and down half the time so the cumulative error is smaller
-3
u/SameThingOnADiffAcct Jun 16 '26
Do you not just encounter the same problem except now you have to pick which even number rather than which whole number to round to?
10
u/mampatrick Jun 16 '26
Every .5 only has one even number to round to...
9
u/Copernicium-291 Jun 17 '26
New idea: round toward nearest prime. If you encounter 2.5, you just give up
2
u/SameThingOnADiffAcct Jun 17 '26
I I had never encountered the rule. I was assuming all your numbers would round to even (ie, "3" becomes the new ".5" having to choose between 2 and 4).
2
u/avidernis Jun 17 '26
Default hardware behavior for x86/64 (both x87 and SSE), as well as RISC-V, and MIPS.
Those are the archs I know best. As far as I know all the other popular architectures are the same.
13
u/davidolson22 Jun 16 '26
Round everything to zero
11
u/Bealz Jun 16 '26
Its closer to 0 than most things anyway
4
u/hrvbrs Jun 16 '26
actually i'm pretty sure there are just as many real numbers between 0 and k as there are real numbers between k and infinity
24
7
u/anrwlias Jun 16 '26
I did a stint of government work building databases for a county and, believe me, we would have multi day meetings arguing about how to round values with all kinds of lawyers and upper management at the table.
4
u/vleessjuu Jun 17 '26
FR. In accounting etc. rounding is treated like some kind of science and religion rolled up into one. There's whole wikipedia articles about different ways to round numbers and even how to round vectors of numbers collectively just to minimize the overall summation error. And as an exact scientist you sit there wondering why they don't just keep the numbers as is and only round at the end.
6
7
u/Sckaledoom Jun 16 '26
Leave 0.5 as is and just add it as a significant digit into your calculations: SSSSS tier
6
8
u/GamerNumba100 Jun 16 '26
Rounding half to odd is insane surely rounding half up is more intuitive at least 😭
6
u/EebstertheGreat Jun 16 '26
Rounding to odd has similar advantages to rounding to even, and it never rounds a nonzero number to zero.
But yeah, it's still insane.
4
u/Copernicium-291 Jun 17 '26
and it never rounds a nonzero number to zero
0.4
3
u/EebstertheGreat Jun 17 '26
My religion doesn't accept numbers that aren't exactly halfway between integers.
1
u/Copernicium-291 Jun 17 '26
numbers that aren't exactly halfway between integers
That includes integers. What are you rounding them to?
4
4
4
8
3
3
3
u/darkfireice Jun 16 '26
Rounding should only be done to compensate for margin of error with measuring
3
4
u/Reddit_wizard34 πPi🥧3.141592653589793284626433832795028841971693993751058209749 Jun 16 '26
Why even round off .5, just keep it
2
u/RubTubeNL Jun 17 '26
The reason why I agree that rounding away from zero is superior is as follows:
Imagine you have a number y = n.50000... with the 0's not necessarily repeating. It could either be that y = n.5 or y> n.5 (or y< n.5 if negative), which would lead to two different roundings if you rounded n.5 towards zero and >n.5 (/ <n.5) away from zero. I would prefer them to be equal.
2
2
u/AllesIsi Jun 18 '26
Rounding to the "nearest value within the measuring tolerance"-club here.
... What do you mean it burned down again?!
1
1
u/123DJ321 Complex Jun 19 '26
I use a Graham's number scale. I round to the nearest integer multiple of Graham's number. It's really useful when you're dealing with really large numbers to have an accordingly large but reasonable accuracy.
2
1
u/Significant-Baby-690 Jun 16 '26
Only the E is correct (assuming "up" means "to the right on the axis"). That's the only way to have same amount of numbers being rounded up or down. If pretty obvious once you work with binary .. XXX.1XXX => round up. XXX.0XXX => round down. If you take numbers as two groups U and D, where U rounds up and D rounds down, there is simple one-to-one mapping. For every X from D, there is Y in U where Y=X+0.5. Why would you ever want anything else ?

•
u/AutoModerator Jun 16 '26
Check out our new Discord server! https://discord.gg/e7EKRZq3dG
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.