Author |
Message |
DaveAngus
![](http://compsci.ca/v3/uploads/user_avatars/121496826447fbae72bc179.gif)
|
Posted: Tue Apr 01, 2008 9:14 am Post subject: HOw to round decimal points. |
|
|
Hey guys.
This is such a noob question but it is one of those things I have never bothered learning because you dont think much about it.
HOw do you round dcecimals?
I have this proceduare that when it calculates the answer it NORMALLY comes out like a HUGE decimal.
If you could let me know how to round it to one decimal point,
that would be great!
Thanks a lot,
-Dave |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
Posted: Tue Apr 01, 2008 9:41 am Post subject: RE:HOw to round decimal points. |
|
|
rounding to closest integer is done with round(). To save that one (or any number really) decimal point beyond the integer "cutoff", think powers of 10 |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
![](images/spacer.gif) |
DaveAngus
![](http://compsci.ca/v3/uploads/user_avatars/121496826447fbae72bc179.gif)
|
Posted: Tue Apr 01, 2008 10:03 am Post subject: RE:HOw to round decimal points. |
|
|
Thanks a lot Tony for the help! |
|
|
|
|
![](images/spacer.gif) |
Doug101
|
Posted: Tue Apr 01, 2008 10:41 am Post subject: Re: HOw to round decimal points. |
|
|
k all you need to do is use the round comand.
eg.
round(variable) |
|
|
|
|
![](images/spacer.gif) |
DaveAngus
![](http://compsci.ca/v3/uploads/user_avatars/121496826447fbae72bc179.gif)
|
Posted: Wed Apr 02, 2008 10:40 am Post subject: RE:HOw to round decimal points. |
|
|
doug...again, Tony helped me.
Therefor I dont need your help
you just copied what he said.
Again, my threads arent for you to boost your posts |
|
|
|
|
![](images/spacer.gif) |
Doug101
|
Posted: Wed Apr 02, 2008 10:42 am Post subject: Re: HOw to round decimal points. |
|
|
sry i didnt read his. |
|
|
|
|
![](images/spacer.gif) |
DaveAngus
![](http://compsci.ca/v3/uploads/user_avatars/121496826447fbae72bc179.gif)
|
Posted: Wed Apr 02, 2008 10:43 am Post subject: RE:HOw to round decimal points. |
|
|
read all posts before you reply |
|
|
|
|
![](images/spacer.gif) |
Doug101
|
Posted: Wed Apr 02, 2008 10:44 am Post subject: Re: HOw to round decimal points. |
|
|
sry i didnt really feal like reading them . |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
DaveAngus
![](http://compsci.ca/v3/uploads/user_avatars/121496826447fbae72bc179.gif)
|
Posted: Wed Apr 02, 2008 10:46 am Post subject: RE:HOw to round decimal points. |
|
|
then dont post |
|
|
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
Posted: Wed Apr 02, 2008 10:53 am Post subject: RE:HOw to round decimal points. |
|
|
DaveAngus has an excellent point there. Saying random stuff without reading the thread is a quick way to get banned. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
![](images/spacer.gif) |
|