floor.hpp
Go to the documentation of this file.
#ifndef STAN_MATH_REV_SCAL_FUN_FLOOR_HPP
#define STAN_MATH_REV_SCAL_FUN_FLOOR_HPP
#include <stan/math/rev/core.hpp>
#include <stan/math/prim/scal/fun/is_nan.hpp>
#include <stan/math/prim/scal/meta/likely.hpp>
#include <cmath>
#include <limits>
namespace stan {
namespace math {
namespace {
class floor_vari : public op_v_vari {
public:
explicit floor_vari(vari* avi) :
op_v_vari(std::floor(avi->val_), avi) {
}
void chain() {
if (unlikely(is_nan(avi_->val_)))
avi_->adj_ = std::numeric_limits<double>::quiet_NaN();
}
};
}
inline var floor(const var& a) {
return var(new floor_vari(a.vi_));
}
}
}
#endif
core.hpp
is_nan.hpp
stan
Definition: log_sum_exp.hpp:8
std
Definition: std_numeric_limits.hpp:7
stan::math::var
Independent (input) and dependent (output) variables for gradients.
Definition: var.hpp:30
unlikely
#define unlikely(x)
Definition: likely.hpp:9
stan::math::var::vi_
vari * vi_
Pointer to the implementation of this variable.
Definition: var.hpp:42
likely.hpp
stan::math::floor
fvar< T > floor(const fvar< T > &x)
Definition: floor.hpp:11
stan::math::is_nan
int is_nan(const fvar< T > &x)
Returns 1 if the input&#39;s value is NaN and 0 otherwise.
Definition: is_nan.hpp:21

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