Automatic Differentiation
 
Loading...
Searching...
No Matches

◆ ceil() [5/6]

var stan::math::ceil ( const var a)
inline

Return the ceiling of the specified variable (cmath).

The derivative of the ceiling function is defined and zero everywhere but at integers, and we set them to zero for convenience,

\(\frac{d}{dx} {\lceil x \rceil} = 0\).

The ceiling function rounds up. For double values, this is the smallest integral value that is not less than the specified value. Although this function is not differentiable because it is discontinuous at integral values, its gradient is returned as zero everywhere.

\[ \mbox{ceil}(x) = \begin{cases} \lceil x\rceil & \mbox{if } -\infty\leq x \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{ceil}(x)}{\partial x} = \begin{cases} 0 & \mbox{if } -\infty\leq x\leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

Parameters
aInput variable.
Returns
Ceiling of the variable.

Definition at line 47 of file ceil.hpp.