Page 1 of 1

Mod mathematical function

Posted: Thu May 04, 2006 10:24 am
by Aeros
Quick question - is there an equivalent of the mathematical function "mod" in POL atm?

I can't find it anywhere in the script refs, but cant imagine it not being in pol at all either. Alternatively, is there any way to determine the remainder of a divided number?

Posted: Thu May 04, 2006 10:32 am
by CWO
dont know how well this will work but it should for remainders to division...

remainder := numerator - ( CInt(numerator / denominator) * denominator);

I also looked for something before to find remainders. Something like the % operator in many languages.

Posted: Thu May 04, 2006 11:18 am
by Lagoon
escript has the mod operator %

Posted: Thu May 04, 2006 1:55 pm
by Aeros
Yeah, I also did it like this, wrote my own mod function to handle these things, basically containing:

Code: Select all

	var f := Cint(e / 7);
	var g := Cint(e - (7 * f));
Where the formula was basically "e mod 7", g being the answer to this.

Posted: Thu May 04, 2006 5:17 pm
by Austin
Try Print ( 9 % 2 )

% is the mod. operator.

Posted: Thu May 04, 2006 5:34 pm
by Danielle

Posted: Thu May 04, 2006 5:46 pm
by Aeros
I did - just the wrong manual in this case. Was looking for it in math.em.

Posted: Thu May 04, 2006 9:38 pm
by CWO
Well actually Danielle I learned POL through Raclac's EScript Guide which is somewhat of a manual til this day and I never knew it existed because there isnt 1 % char in that entire thing.

Posted: Fri May 05, 2006 12:15 am
by tekproxy
You can usually count on these guys: + - * / ^ %

Posted: Fri May 05, 2006 3:31 am
by Danielle
CWO wrote:Well actually Danielle I learned POL through Raclac's EScript Guide which is somewhat of a manual til this day and I never knew it existed because there isnt 1 % char in that entire thing.
I know, which is why I'm trying to write a new one; the wiki.

Posted: Fri May 05, 2006 7:04 am
by Lagoon
Danielle wrote: I know, which is why I'm trying to write a new one; the wiki.
Which is a great project, I hope many guys here will contribute to it, it's coming along very nicely.. personally I'd like to contribute... I'm sure I will, I only need to find the force to fill my wiki-editing-ignorance gap :P

Posted: Fri May 05, 2006 8:48 am
by MuadDib
I asked you in irc later, if you meant modulos, cuz that is what I called the %, which I knew existed already, hehe

I see how it is, just ignore the lonely guy who never talks :)

Posted: Fri May 05, 2006 12:25 pm
by Aeros
Lol, ohhh, i saw that later yeah :P