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

◆ trunc() [5/5]

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

Returns the truncation of the specified variable (C99).

See trunc() for the double-based version.

The derivative is zero everywhere but at integer values, so for convenience the derivative is defined to be everywhere zero,

\(\frac{d}{dx} \mbox{trunc}(x) = 0\).

\[ \mbox{trunc}(x) = \begin{cases} \lfloor x \rfloor & \mbox{if } -\infty\leq x\leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

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

Parameters
aSpecified variable.
Returns
Truncation of the variable.

Definition at line 43 of file trunc.hpp.