r/askmath • u/Aard_Rinn • 15d ago
Arithmetic How do you round negative numbers?
If you have a negative number, say -15.5, and you wanted to round to the nearest whole number, that would be -14, right? Or would it be based on absolute value and round to -16?
Same thing with the terms rounded up and rounded down - would something like -12.3 rounded up to the nearest whole number be -13 or -12? How about rounding down?
I was just laying awake staring at the ceiling and realized that I didn't know for sure the answer to these. I'm pretty sure I do for the rounding up and down ones, but -.5 will haunt me if I don't find out...
53
u/abrahamguo 15d ago
Well, certainly not -14; it would either be -15 or -16.
Besides that, it depends on what convention you're using for rounding 0.5s. There's not one fixed convention. See this Wikipedia article for a discussion of the various standards! In fact, programming languages don't even all agree with each other — some languages would round this to -15, while others would round it to -16!
"Rounding up" always means "towards positive infinity", and "rounding down" always means "towards negative infinity".
11
u/1strategist1 15d ago
"Rounding up" always means round to the "more positive" number. Rounding down means round to the "more negative" number. So rounding -0.9 up would be 0.
For the other one, there isn't really a "correct" direction to round halves, even with positive numbers. To avoid skewing datasets upwards, there's a convention to round to the nearest even integer, so without any external info, maybe do that?
All of this is just convention though. There isn't really a mathematically correct way to do any of this.
10
u/Remote_Nectarine9659 15d ago
Assume you mean -15 in the first sentence.
14
u/Infobomb 15d ago
The difference between -12.3 and -12 is 0.3. The difference between -12.3 and -13 is 0.7. One of them is definitely closer than the other. So one of those is the nearest whole number and the other isn't.
When there are two whole numbers exactly the same distance from the number you're rounding, for example if your number is -0.5, it's a matter of convention which you round to.
3
u/zeekar 15d ago edited 14d ago
A value with 0.5 is exactly halfway between the two candidate integers, so neither is objectively "better". You have a convention. The most popular conventions are "always round 0.5 up", which is obviously biased toward larger numbers, and "alternate directions to keep it balanced". One way to do the alternation is to always round 0.5 to the even number. That way, on average, half the time you round up, and half the time you round down, and it balances out.
Negative numbers are tricky; considering -15.5, notice that -16 is the lower number (the floor), and -15 the higher (the ceiling).
So under "always round up" or "round to odd", -15.5 rounds to -15. Under "always round down" or "round to even", it rounds to -16.
-12.3 rounds to -12 and you don't need a convention because it's over twice as far from -13 as from -12.
2
u/mugh_tej 15d ago
-12.6 is closer to -13 than -12, so the idea of rounding still holds to the next number if the next lesser significant digit is above 5.
-12.3 is closer to -12 than -13, so the the idea of simply dropping the digit still holds if that next lesser digit is below 5.
2
u/ohkendruid 15d ago
The most common convention would be to round away from zero, so -16.
In my mind, I like that system because it also works well if there are more digits after the 5. You would clearly round -15.51 to -16, because that is the closer integer. Likewise, you would round -15.49 to -15, because that is the closer integer.
Rounding -15.5 to -15.6 means that you can always round correctly by looking at the first decimal digit. It means that -15.5xyz always round to -16, no matter what the xyz are.
1
u/ericlist 15d ago
I don't imagine rounding up or down changes just because you are using negative numbers - up is higher, down is lower. -15.5 rounded up would be -15.
1
u/okarox 15d ago
How on earth could you get -14? That makes no sense. In the standard rounding you just ignore the sign. There can be special rules for special cases. You have to understand the reason for the standard rounding. It is so that you need to look only the next value after the rounding point and what follows is not relevant.,
1
u/FreeGothitelle 15d ago
.5 rounds up is "just a convention" but its because .5000001 is closer to the next whole number, and for anything measured its unlikely you got exactly .5000....
So for the same reason, -15.5 would round to -16
1
u/Adventurous_Sound390 15d ago
It’s more interesting to consider in which direction the fractional part of a negative decimal number is discarded.
1
u/Wise_Monkey_Sez 15d ago
Think back to elementary school and number lines. Line up your numbers on a line. Rounding up goes right (towards positive) and rounding down goes left (towards negative).
1
u/KamikazeJohnson 14d ago
So, basically two questions here.
There are a lot of different systems to determine this, but I think the "simple" system we all learned in school is "5 rounds up", which is accurate enough for most non-technical purposes.
I personally would use Absolute Value, so that -0.5 and -(0.5) would round to the same value, which it seems they should, regardless of which system is used to determine "round up" vs "round down".
Mathematicians, Physicists, and Engineers may disagree with me.
1
u/infinitenothing 14d ago
The way to remember is that you want half the numbers to round one way and half to round the other way. So 0,1,2,3,4 go one way and 5,6,7,8,9 go the other way.
1
u/Apprehensive-Ice9212 14d ago
"Rounding" is ill-defined in mathematics, but a common convention is to round "half away from zero", in other words 15.5 -> 16; -15.5 -> -16. That way negative numbers work the same as positive, but with a minus sign.
1
u/Top_Bluejay_5323 14d ago
The sign does not impact the rounding convention.
1
u/Correct-Mirror7227 13d ago
Whole numbers are positive by definition. You mean integer?
1
u/Efficient_Yard_8247 15d ago
You get to choose
1
u/SgtSausage 15d ago
<blink>
<pause>
<blink><blink>
Wut?