Stan Math Library  2.12.0
reverse mode automatic differentiation
modulus.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_SCAL_FUN_MODULUS_HPP
2 #define STAN_MATH_PRIM_SCAL_FUN_MODULUS_HPP
3 
6 #include <cstddef>
7 #include <cstdlib>
8 
9 namespace stan {
10  namespace math {
11 
12  inline int modulus(const int x, const int y) {
13  if (unlikely(y == 0))
14  domain_error("modulus", "divisor is", 0, "");
15  return x % y;
16  }
17 
18  }
19 }
20 #endif
#define unlikely(x)
Definition: likely.hpp:9
void domain_error(const char *function, const char *name, const T &y, const char *msg1, const char *msg2)
Throw a domain error with a consistently formatted message.
int modulus(const int x, const int y)
Definition: modulus.hpp:12

     [ Stan Home Page ] © 2011–2016, Stan Development Team.