Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / How to Round up and down.

Author
Message
Outscape
16
Years of Service
User Offline
Joined: 23rd May 2008
Location:
Posted: 19th Jul 2008 21:50 Edited at: 19th Jul 2008 21:51
i used to always want to know this
i always asked in the forums and searched the forums and i always got a realy confusing or un-understandable responce

well heres a simple way when you look at it from the big picture


the command hi# accepts decimals
the command hi wont accept decimals, so if you say hi=hi# then it will munch away the decimals
then you do hi#-hi which simple finds out the missing decimals
and then you do a simple if, if the number is greater than 0.5 than you increase hi by one
and then print hi
if you wanted hi to become a # then simple do
hi#=hi
you may want to do it if its bigger than 0.499

Creators of Outscape

http://forum.thegamecreators.com/?m=forum_view&t=132472&b=8
Outscape
16
Years of Service
User Offline
Joined: 23rd May 2008
Location:
Posted: 19th Jul 2008 21:51
this may be simple but type in rounding up or down and you get a very confusing response lol

Creators of Outscape

http://forum.thegamecreators.com/?m=forum_view&t=132472&b=8
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 20th Jul 2008 18:28
Quote: "FLOOR() and CEIL(). Usage is self-explaining."




I'll post code anyway

Outscape
16
Years of Service
User Offline
Joined: 23rd May 2008
Location:
Posted: 20th Jul 2008 18:32
why doesnt anyone use that on the other threads tho lol
they do like 100lines of IFs and stuff

Creators of Outscape

http://forum.thegamecreators.com/?m=forum_view&t=132472&b=8
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 20th Jul 2008 19:24
Because those commands have only been there since 6.0 updates.

Dark Physics makes any hot drink go cold.

Login to post a reply

Server time is: 2024-09-27 18:22:31
Your offset time is: 2024-09-27 18:22:31