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

◆ log2() [6/6]

template<typename T , require_stan_scalar_or_eigen_t< T > * = nullptr>
auto stan::math::log2 ( const var_value< T > &  a)
inline

Returns the base 2 logarithm of the specified variable (C99).

See log2() for the double-based version.

The derivative is

\(\frac{d}{dx} \log_2 x = \frac{1}{x \log 2}\).

\[ \mbox{log2}(x) = \begin{cases} \textrm{NaN} & \mbox{if } x < 0 \\ \log_2(x) & \mbox{if } x\geq 0 \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{log2}(x)}{\partial x} = \begin{cases} \textrm{NaN} & \mbox{if } x < 0 \\ \frac{1}{x\ln2} & \mbox{if } x\geq 0 \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

Template Parameters
TArithmetic or a type inheriting from EigenBase.
Parameters
aThe variable.
Returns
Base 2 logarithm of the variable.

Definition at line 44 of file log2.hpp.