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 / Wont Divide Properly

Author
Message
Dark Java Dude 64
Community Leader
15
Years of Service
User Offline
Joined: 21st Sep 2010
Location: Neither here nor there nor anywhere
Posted: 13th Dec 2010 04:17
So i try to divide two numbers, each floats, and it still divides as if they were integers. When i use the calc to divide 60 by 45, i get 1.3 so on. but dbp returns 1. and i dont round or anything weird, so



thats just an example, and returns 1...

quick help appreciated!

Behold the new marble game coming soon: Marbsticle Course > > >http://forum.thegamecreators.com/?m=forum_view&t=178472&b=8&p=0 coming January to February 2011
Kevin Picone
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 13th Dec 2010 04:35 Edited at: 13th Dec 2010 04:36
You're dividing two integers, so the DBpro will use an Integer division.

At least one side of the division operator needs to be a float, so then DBPRO will use a Floating point division between the two terms.




For casting variables/expressions see the FLOAT() function.

Dark Java Dude 64
Community Leader
15
Years of Service
User Offline
Joined: 21st Sep 2010
Location: Neither here nor there nor anywhere
Posted: 13th Dec 2010 05:16
I see, that helped! Thanks

Behold the new marble game coming soon: Marbsticle Course > > >http://forum.thegamecreators.com/?m=forum_view&t=178472&b=8&p=0 coming January to February 2011

Login to post a reply

Server time is: 2026-07-21 19:18:36
Your offset time is: 2026-07-21 19:18:36