Mercurial > octave
changeset 29817:ba571657651a stable
Improve documentation for log2 function (bug #60817).
* data.cc (Flog2): Add clearer description of 2-output calling form.
author | Rik <rik@octave.org> |
---|---|
date | Thu, 24 Jun 2021 14:46:56 -0700 |
parents | ba49cea1597f |
children | 0511e3638724 340d6d3dcc94 |
files | libinterp/corefcn/data.cc |
diffstat | 1 files changed, 19 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/data.cc Thu Jun 24 20:46:24 2021 +0200 +++ b/libinterp/corefcn/data.cc Thu Jun 24 14:46:56 2021 -0700 @@ -458,17 +458,32 @@ DEFUN (log2, args, nargout, doc: /* -*- texinfo -*- -@deftypefn {} {} log2 (@var{x}) +@deftypefn {} {@var{y} =} log2 (@var{x}) @deftypefnx {} {[@var{f}, @var{e}] =} log2 (@var{x}) Compute the base-2 logarithm of each element of @var{x}. -If called with two output arguments, split @var{x} into -binary mantissa and exponent so that +If called with one output, compute the base-2 logarithm such that +@tex +$2^y = x$. +@end tex +@ifnottex +@code{2^@var{y} = @var{x}}. +@end ifnottex + +If called with two output arguments, split @var{x} into binary mantissa +(@var{f}) and exponent (@var{e}) such that +@tex +$x = f \cdot 2^e$ +@end tex +@ifnottex +@code{@var{x} = @var{f} * 2^@var{e}} +@end ifnottex +where @tex ${1 \over 2} \le \left| f \right| < 1$ @end tex @ifnottex -@w{@code{1/2 <= abs(f) < 1}} +@w{@code{1/2 <= abs (@var{f}) < 1}} @end ifnottex and @var{e} is an integer. If @tex