mod = / ?

mod = / ?

Return to topic list

Mon Dec 23 08:57:34 2013   by   wyrdR
Both online and command line versions of Troll give me the same bug: there is no discernible difference between the "/" and "mod" operators.

i.e.
a) 123 mod 10 = 12
b) 123 / 10 = 12

Shouldn't a) = 3 ?  - or at least b) = 12.3 ?

PS - Suggestion: Please consider implementing the "%" shorthand for "mod"?

TA

mattR

 
Thu Dec 26 14:55:04 2013   by   wyrdR
\ Found a workaround for now, demonstrated below (tends to error out with 10 digit numbers, but I can live with that)...

function modd(x,y)=
  x-y*(x/y)


a:=d100;
b:=d100;
ab:=call modd(a,b);

'a ||"mod "||'b ||"="||'ab
 
Fri Dec 27 00:33:39 2013   by   Torben
That is, indeed, a bug in the "make random rolls" part of the program.  Adding mod to that part was so trivial that I didn't really test it.  Which I obviously should have, since I forgot to change "div" to "mod" in the copy-pasted code.  The "calculate probabilities" part seems to be O.K.

In any case, it is fixed now.
 
Fri Dec 27 07:55:34 2013   by   wyrdR
Awesome!

Thanks
 

Return to topic list



New message:
Topic:
Posted by:

Type the values of the dice shown below:

Return to topic list