Closed Thread Icon

Preserved Topic: modulo and division--js Pages that link to <a href="https://ozoneasylum.com/backlink?for=18021" title="Pages that link to Preserved Topic: modulo and division--js" rel="nofollow" >Preserved Topic: modulo and division--js\

 
Author Thread
mobrul
Bipolar (III) Inmate

From:
Insane since: Aug 2000

posted posted 06-05-2001 17:38

I have a number (i) and I want to divide it by a constant (6).
From this operation I want the 'remainder', which I can get by the equation 'x=i%6'.
I also want the number of WHOLE times that 'i' goes into 6, but I can't figure out an easy way to do this.

ex.
i=13
x=i%6
x=1

i=13
y='number of Whole times...'
y=2

how do I ask for 'y'?

Anybody help??

mobrul

linear
Paranoid (IV) Inmate

From: other places
Insane since: Mar 2001

posted posted 06-05-2001 17:40

Math.floor(1/6)

edit: added the url


[This message has been edited by linear (edited 06-05-2001).]

mobrul
Bipolar (III) Inmate

From:
Insane since: Aug 2000

posted posted 06-05-2001 17:49

damn, linear, that was quick.
I don't think I understand...where do I put my variable (i)??
sorry for being so dense...

mobrul

<edit> this is creepy, everytime i look something is changed...you should just call me...eliminate the middle man...</edit>

[This message has been edited by mobrul (edited 06-05-2001).]

linear
Paranoid (IV) Inmate

From: other places
Insane since: Mar 2001

posted posted 06-05-2001 17:51

I guess that was supposed to be
Math.floor(i/6)

Edit: yes, my 'bot is acting up again...

[This message has been edited by linear (edited 06-05-2001).]

mobrul
Bipolar (III) Inmate

From:
Insane since: Aug 2000

posted posted 06-05-2001 17:53

Followed the link...that's good stuff.
Thanks.

mobrul

linear
Paranoid (IV) Inmate

From: other places
Insane since: Mar 2001

posted posted 06-05-2001 17:57

here's the real front door, for those following along at home.

« BackwardsOnwards »

Show Forum Drop Down Menu