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.

DarkBASIC Professional Discussion / Rounding numbers to the nearest hundred

Author
Message
Terabyte
23
Years of Service
User Offline
Joined: 28th Dec 2002
Location: UK
Posted: 15th Aug 2003 15:47
I seem to have written some code and despite it meaning to be exact i seem to be getting ridiculous number co ordinates i.e. instead of 0 i get 1.2E83423 etc....
is there anyway of rounding this number to the nearest hundred. so that number would become 0 and -99.4E82323 would become -100.
cheers
>>TerraByte. Putting the Byte back into Terragramming<< If my post has less than 20 typos then it wasnt me who wrote it!
http://darkdayssoftware.250free.com/Logo394.GIF[/img]
Mentor
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 15th Aug 2003 16:06
answer#=(int (number#*100))/100.0


Mentor.

Fallout
23
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 15th Aug 2003 17:03
Oops. Got your * and / round the wrong way. I think its:

answer#=(int(number#/100.0))*100

Insiiiiiiiiiiiiiiiiiiiiiiiide!
Mentor
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 15th Aug 2003 17:12
umm! yes!, I misread the post and thought the problem was the fraction, I just wrote a reply saying "no! thats right!" to you, then I stopped and looked again , he wanted values to the closest 100, I thought he wanted values to the closest 100th. oops!

Mentor.

Fallout
23
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 15th Aug 2003 19:07
haha! Narrowly avoided one of those crappy db forum arguments over a misunderstanding then. Actually, come to think of it, I'm not in the mood today. I probably would've replied with something like "ok".

Insiiiiiiiiiiiiiiiiiiiiiiiide!

Login to post a reply

Server time is: 2026-07-22 17:14:59
Your offset time is: 2026-07-22 17:14:59