Automatic Differentiation
 
Loading...
Searching...
No Matches
modulus.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_FUN_MODULUS_HPP
2#define STAN_MATH_PRIM_FUN_MODULUS_HPP
3
6#include <cstddef>
7#include <cstdlib>
8
9namespace stan {
10namespace math {
11
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
#define unlikely(x)
int modulus(int x, int y)
Definition modulus.hpp:12
void throw_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.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...