View Full Version : How do you round up decimal numbers?


Christopher_Lee
Thu, 28th Feb '02, 12:22pm
Does anybody here happen to know how to round up decimal numbers that end in 5? For instance: 118.5.

Please help!! :aaa::aaa:

Asmodeus
Thu, 28th Feb '02, 12:26pm
I thught it was common knowledge that decimals of 5 are supposed to be rounded upwards. 118.5 will make 119.

Christopher_Lee
Thu, 28th Feb '02, 12:32pm
Is it? I always thought it was something to do whether the digit before it is even or odd-numbered? :confused::borg:

the god
Thu, 28th Feb '02, 12:39pm
yep, rounding-up from 0.5 is what they teach in british schools anyway. :square:

Jack Funk
Thu, 28th Feb '02, 4:33pm
Same in USA.

Mollusken
Thu, 28th Feb '02, 8:52pm
C or C++ will tell you that it is 118.

Spudsquisher
Thu, 28th Feb '02, 9:59pm
*puts on A-level economics hat*

why do you wanna round it up?
why not just leave the .5 and look clever?
oh and we were always taught to go up.
same as you work left to right when sloving things like: (3y + 2x) (13y - 5x)

Jerlark386
Thu, 28th Feb '02, 10:01pm
rounding up is typical, but when it comes to money, rounding down is what you'll be doing more of.

the god
Thu, 28th Feb '02, 10:43pm
:lol: J386 has hit the nail on the head.

Avarahtar
Fri, 1st Mar '02, 12:02am
Actually by convention you are supposed to round to the nearest even number. So if the number is 118.5 you would round down to 118 but if it was 119.5 you would round up 120. This is to help eliminate the percentage error you would get if you always rounded the .5 up.

Christopher_Lee
Fri, 1st Mar '02, 1:25am
Yep that's it! I remember now that's the way I was taught to do it. Thank you Avarahtar! :cool:

Maldir
Fri, 1st Mar '02, 1:53pm
There's no percentage error: x.00 to x.49 are rounded off to x.00, and x.50 to x.99 are rounded off to (x+1).00. Some computers convert decimals to integers by lopping off the numbers after the decimal point, which isn't the same as rounding off - it's rounding down.

Spudsquisher
Fri, 1st Mar '02, 8:40pm
118.541732
118.54173
118.5417
118.542
118.54
118.5
119

Avarahtar
Sat, 2nd Mar '02, 12:14am
When writting up experiments there is always a percentage error and if you always round the 5 up it can cause your result to be higher then it should be. This is especially true when working with a small amount of significant figures. I could type out an example of this but since it's not really a topic I care to spend much time arguing about I'm not going to waste my time with it.