Stan Math Library
2.15.0
reverse mode automatic differentiation
stan
math
prim
scal
fun
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
(
int
x,
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
stan::math::modulus
int modulus(int x, int y)
Definition:
modulus.hpp:12
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
domain_error.hpp
[
Stan Home Page
]
© 2011–2016, Stan Development Team.