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 Discussion / Div and Mod

Author
Message
Sam Cruise
21
Years of Service
User Offline
Joined: 11th Oct 2002
Location:
Posted: 25th Nov 2002 14:01
Is there anyway to simulate DIV and MOD in DB?

Thanks
spooky
21
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 25th Nov 2002 14:14
MOD works in DBPro, not sure about DB

e.g. 20 MOD 7 = 6

I love it when a plan comes together
hexGEAR
21
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Naytonia
Posted: 25th Nov 2002 14:25
If i'm correct and MOD returns the remainder then this function should help i think:



theres no remainder (MOD) function in db classic so i made this one part of a common code project. you put in the two numbers (num1 > num2) and it resturns the remainder, have not tested for -ve numbers yet

your birth was a blessing, sent to live and die on earth as a lesson, we each have a star all you have to do is find it, once you do, everyone who sees it will be blinded - DMX
hexGEAR
21
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Naytonia
Posted: 25th Nov 2002 14:27
what does the DIV function do? maybe i can come up with some code for that too

your birth was a blessing, sent to live and die on earth as a lesson, we each have a star all you have to do is find it, once you do, everyone who sees it will be blinded - DMX

Login to post a reply

Server time is: 2024-03-03 02:16:49
Your offset time is: 2024-03-03 02:16:49