-2

What is the meaning of the symbol '%' such as in this sentence:

assert (timesteps % pool_size == 0)

2 Answers2

1

It is the modulo operation. Which returns the remainder from divison on 2 numbers.

3 % 1 = 0
3 % 2 = 1
3 % 3 = 0

So in your code if pool_size becomes equal to timesteps or is a factor of it, then the result would be 0

https://en.wikipedia.org/wiki/Modulo_operation

static const
  • 953
  • 4
  • 16
0

% is the modulo operator. It gives you the remainder after dividing the left-hand side by the right-hand side. For instance, 12 % 10 will return 2.

Here, it's being used to check if timesteps is divisible by pool_size.

Moira Jones
  • 369
  • 1
  • 7