1 #ifndef STAN_MATH_PRIM_FUN_MODULUS_HPP 2 #define STAN_MATH_PRIM_FUN_MODULUS_HPP 3 4 #include <stan/math/prim/meta.hpp> 5 #include <stan/math/prim/err.hpp> 6 #include <cstddef> 7 #include <cstdlib> 8 9 namespace stan { 10 namespace math { 11 modulus(int x,int y)12inline int modulus(int x, int y) { 13 if (unlikely(y == 0)) { 14 throw_domain_error("modulus", "divisor is", 0, ""); 15 } 16 return x % y; 17 } 18 19 } // namespace math 20 } // namespace stan 21 #endif 22