| Stan Math Library 2.12.0 reverse mode automatic differentiation

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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
4 #include <stan/math/prim/scal/err/domain_error.hpp>
5 #include <stan/math/prim/scal/meta/likely.hpp>
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
stan
Definition: log_sum_exp.hpp:8
unlikely
#define unlikely(x)
Definition: likely.hpp:9
likely.hpp
stan::math::domain_error
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.
Definition: domain_error.hpp:30
stan::math::modulus
int modulus(const int x, const int y)
Definition: modulus.hpp:12
domain_error.hpp

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