The Dink Network

Modulo

August 11th 2006, 01:44 PM
goblins.gif
Neo
Peasant He/Him Poland
He Who Would Steal The Flame Must Die 
Is there any other (more ellegant) way to find the modulo of a number (to be exact, to find if a number is dividable by X) than making something like that:

int &number = 632;
int &temp = &number / 3;
&temp = &temp * 3;
if (&temp == &number)
{
blahblah
}

...?
August 11th 2006, 01:59 PM
custom_magicman.gif
magicman
Peasant They/Them Netherlands duck
Mmmm, pizza. 
If you have Dink 1.08, here's the dinkc.chm entry for math_mod:

math_mod
Category: Math
Version: 1.08+
Prototype: int math_mod(int value, int divisor);

math_mod returns the remainder of value divided by divisor.

so:

int &crap = math_mod(632, 3)
if (&crap == 0)
{
//blahblah
}
August 11th 2006, 01:59 PM
goblins.gif
Neo
Peasant He/Him Poland
He Who Would Steal The Flame Must Die 
I love you.
August 11th 2006, 04:32 PM
custom_carrie2004.gif
carrie2004
Peasant She/Her Canada
*chomp* 
*giggles* Neo loves Magicman.
August 12th 2006, 10:37 AM
slimeb.gif
DaVince
Peasant He/Him Netherlands
Olde Time Dinkere 
I always thought that Neo IS a magic man, him being the One and all.