Stan Math Library
4.9.0
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
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
12
inline
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
unlikely
#define unlikely(x)
Definition
compiler_attributes.hpp:31
stan::math::modulus
int modulus(int x, int y)
Definition
modulus.hpp:12
stan::math::throw_domain_error
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.
Definition
throw_domain_error.hpp:26
stan
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
Definition
unit_vector_constrain.hpp:15
err.hpp
meta.hpp
stan
math
prim
fun
modulus.hpp
[
Stan Home Page
]
© 2011–2019, Stan Development Team.